只是一个简单的INotifyPropertyChanged接口使用的示例类,在wpf中学习到的,应用数据绑定。
public class Stuents : INotifyPropertyChanged
{
private string _name;
public string Name
{
get { return _name; }
set
{
_name = value;
NotifyPropertyChanged(Name);
}
}
private string _age;
public string Age
{
get { return _age; }
set
{
_age = value;
NotifyPropertyChanged(Age);
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(string info)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(info));
}
}
}