D
David Ching
Hello,
I have defined:
public class RawStat : INotifyPropertyChanged
{
...
}
public class RawStatCollection : ObservableCollection<RawStat>
{
...
}
void rawStats_CollectionChanged(object sender,
System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
MessageBox.Show("RawStats changed");
}
var rawStats = new RawStatCollection();
rawStats.CollectionChanged += rawStats_CollectionChanged;
rawStats_CollectionChanged() is properly called when I add something to the
collection , e.g.
rawStats.Add (new RawStat);
But if the RawStat itself is changed, even though it implements
INotifyPropertyChanged, I am not getting a notification for
rawStats_CollectionChanged. I would argue that I should be, since changing
an item in a collection is changing the contents of the collection itself.
But, putting aside theoretical debate, is there any easy way to get notified
when the RawStat has changed, short of sinking the PropertyChanged event for
every RawStat I add to the collection?
Thanks,
David
I have defined:
public class RawStat : INotifyPropertyChanged
{
...
}
public class RawStatCollection : ObservableCollection<RawStat>
{
...
}
void rawStats_CollectionChanged(object sender,
System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
MessageBox.Show("RawStats changed");
}
var rawStats = new RawStatCollection();
rawStats.CollectionChanged += rawStats_CollectionChanged;
rawStats_CollectionChanged() is properly called when I add something to the
collection , e.g.
rawStats.Add (new RawStat);
But if the RawStat itself is changed, even though it implements
INotifyPropertyChanged, I am not getting a notification for
rawStats_CollectionChanged. I would argue that I should be, since changing
an item in a collection is changing the contents of the collection itself.
But, putting aside theoretical debate, is there any easy way to get notified
when the RawStat has changed, short of sinking the PropertyChanged event for
every RawStat I add to the collection?
Thanks,
David