namespace MimicCreation
{
public class TreeManager : INotifyPropertyChanged
{
public TreeManager() { }
public TreeManager(string title, string type, string filename)
{
this.childElementsValue.CollectionChanged += this.OnCollectionChanged;
Title = title;
Type = type;
FileName = filename;
}
public string Title { get; set; }
public string Type { get; set; }
public string FileName { get; set; }
public override string ToString()
{
return Title;
}
private ObservableCollection<TreeManager> childElementsValue = new ObservableCollection<TreeManager>();
public ObservableCollection<TreeManager> ChildElements
{
get { return childElementsValue; }
set { childElementsValue = value; }
}
public void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
switch (e.Action)
{
case NotifyCollectionChangedAction.Add:
foreach (TreeManager item in e.NewItems)
{
((System.ComponentModel.INotifyPropertyChanged)item).PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(OnPropertyChanged);
}
break;
}
}
public void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
}
}
}
我收到以下错误:错误“MimicCreation.TreeManager”不实现接口成员“System.ComponentModel.INotifyPropertyChanged.PropertyChanged”在编译。我有一个可观察的集合,我希望能够在可观察集合中的每个项目都被更改时访问通知,所以我不能看到我做错了什么。请有任何想法吗?不实现接口成员“System.ComponentModel.INotifyPropertyChanged.PropertyChanged”
谢谢。