根据Silverlight TwoWay绑定的工作原理,当我更改FirstName字段中的数据时,它应该更改CheckFirstName字段中的值.
为什么不是这样?
谢谢杰夫,就是这样,对于其他人:这里是可下载代码的完整解决方案.
XAML:
First Name: Last Name: Address:
代码背后:
public Page() { InitializeComponent(); Customer customer = new Customer(); customer.FirstName = "Jim"; customer.LastName = "Taylor"; customer.Address = "72384 South Northern Blvd."; GridCustomerDetails.DataContext = customer; Customer customerOutput = (Customer)GridCustomerDetails.DataContext; CheckFirstName.Text = customer.FirstName; }
Jeff Yates.. 5
您的Customer
类型必须支持INotifyPropertyChanged
,以便绑定知道您的FirstName
属性值何时更改.
本教程可以帮助您使代码工作.
您的Customer
类型必须支持INotifyPropertyChanged
,以便绑定知道您的FirstName
属性值何时更改.
本教程可以帮助您使代码工作.