private void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) {
switch (e.Action) {
case NotifyCollectionChangedAction.Reset:
foreach (var item in NonfilteredList) {
item.PropertyChanged += Entry_PropertyChanged;
item.Deleted += Entry_Deleted;
}
break;
case NotifyCollectionChangedAction.Add:
case NotifyCollectionChangedAction.Remove:
case NotifyCollectionChangedAction.Replace:
if (e.OldItems != null) {
foreach (RaceGridEntry item in e.OldItems) {
item.PropertyChanged -= Entry_PropertyChanged;
item.Deleted -= Entry_Deleted;
}
}
if (e.NewItems != null) {
foreach (RaceGridEntry item in e.NewItems) {
item.PropertyChanged += Entry_PropertyChanged;
item.Deleted += Entry_Deleted;
}
}
break;
case NotifyCollectionChangedAction.Move:
break;
}
}