void OnItemPropertyChanged(object sender, PropertyChangedEventArgs e) { Kontakt kontakt = sender as Kontakt; if (kontakt != null) { ModifiedKontakte.Add(kontakt); } }
void OnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.NewItems != null) { foreach (Kontakt newItem in e.NewItems) { ModifiedKontakte.Add(newItem); newItem.PropertyChanged += this.OnItemPropertyChanged; } } if (e.OldItems != null) { foreach (Kontakt oldItem in e.OldItems) { ModifiedKontakte.Add(oldItem); oldItem.PropertyChanged -= this.OnItemPropertyChanged; } } }