国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書(shū)等14項(xiàng)超值服

開(kāi)通VIP
WPF 綁定到非FrameworkElement對(duì)象

WPF 綁定到非FrameworkElement對(duì)象

(2013-01-31 09:19:47)
         <Label>請(qǐng)輸入姓名:</Label>
          <TextBoxBackground="SkyBlue">
            <!--使用屬性元素語(yǔ)法綁定到Person類(lèi),指定Path為PersonName公共屬性-->
            <TextBox.Text>
                <Binding Source="{StaticResource myDataSource}"Path="PersonName" Mode="TwoWay"UpdateSourceTrigger="PropertyChanged"/>
            </TextBox.Text>
         </TextBox>
          <StackPanelOrientation="Horizontal">
         <Label>輸入的名字:</Label>
         <!--使用Source屬性獲取更新后的屬性值,由于Person類(lèi)實(shí)現(xiàn)了INotifyPropertyChanged接口,因此更改會(huì)立即被顯示-->
             <TextBlock Background="Orange"Text="{Binding Source={StaticResource myDataSource},Path=PersonName}" Width="100" Height="30"HorizontalAlignment="Left"/>
         </StackPanel>



   //實(shí)現(xiàn)INotifyPropertyChanged
    //以支持單向和雙向綁定
    public class Person :INotifyPropertyChanged
    {
       private string _personName;
       public string PersonName
       {
          get 
          
              return_personName; 
           }
           set
           {
              _personName = value;
             OnPropertyChanged("PersonName");
           }
       }
       
       public Person()
       {
       }
       public Person(string value)
       {
          this._personName = value;
       }

       public event PropertyChangedEventHandlerPropertyChanged;
       protected void OnPropertyChanged(stringpropertyName)
       {
          PropertyChangedEventHandler handler = PropertyChanged;
           if(handler != null)
           {
              handler(this, newPropertyChangedEventArgs(propertyName));
           }
       }
    }
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶(hù)發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
Silverlight 4 數(shù)據(jù)綁定
閑話(huà)WPF之二一(WPF中的數(shù)據(jù)處理 [3])
Data Binding和INotifyPropertyChanged是如何協(xié)調(diào)工作的?
關(guān)于WPF的驗(yàn)證
深入淺出WPF之Binding的使用(一)
asp.net2.0 hiddenfield控件_asp.net技巧-NET編程
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服