【发布时间】:2010-12-14 17:21:41
【问题描述】:
这是我的 ViewModel -
public class ViewModel
{
public ObservableCollection<Person> Persons { get; set; }
}
这是类人:
public class Person : INotifyPropertyChanged
{
private string _firstName;
public string FirstName
{
get { return _firstName; }
set
{
_firstName = value;
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs("FirstName"));
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
}
现在,每当其中一个人的名字发生变化时,我都想做一些任务, 假设提出一个消息框。
我该怎么做?
【问题讨论】:
标签: wpf binding datacontext