wpf binging Class 双向绑定 需要实现的接口

 public class HuMan : INotifyPropertyChanged
{
private string name;
private string age;
private string sex; public event PropertyChangedEventHandler PropertyChanged; public string Name
{
get { return name; }
set
{
name = value;
Console.WriteLine(value);
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Name"));
}
}
public string Age
{
get { return age; }
set
{
age = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Age"));
}
} public string Sex
{
get { return sex; }
set
{
sex = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Sex"));
}
}
}

  

Class 需要实现 INotifyPropertyChanged 接口 以及在属性的 set方法里通知 外部ui 什么Name的属性被修改
上一篇:鸟哥笔记:linux系统日志文件介绍


下一篇:关于spring事务