【发布时间】:2015-06-15 09:23:07
【问题描述】:
这是我的模型:
class Person : INotifyPropertyChanged
{
public static int Counter;
public string _firstName;
public string _lastName;
public event PropertyChangedEventHandler PropertyChanged;
public string FirstName
{
get {return _firstname; }
set
{
_fileName = value;
NotifyPropertyChange("FirstName");
}
}
public AddPerson(Person person)
{
Counter++;
}
}
我有这个NotifyPropertyChange,它改变了我在ListView 中的所有Persons 属性,我想添加Counter 字段来保存我拥有的Objects 的数量。
那么可以为我的static 变量添加另一个PropertyChanged Event 吗?
【问题讨论】:
-
为什么不直接在
ListView中引用Count属性?不需要柜台。