8,735
社区成员
发帖
与我相关
我的任务
分享
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);