8,756
社区成员




public class PersonModel : INotifyPropertyChanged
{
private string _forename;
public string Forename
{
get { return _forename; }
set
{
if (value == _forename)
return;
_forename = value;
OnPropertyChanged("Forename");
}
}
}
Binding binding = new Binding("DataContext.Forename");
binding.Source = this;
binding.Mode = BindingMode.TwoWay;
this.cityContext.SetBinding(TextBox.TextProperty, binding);
Binding binding = new Binding("DataContext.Forename");
binding.RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(Window), 1);
binding.Mode = BindingMode.TwoWay;
this.cityContext.SetBinding(TextBox.TextProperty, binding);