private void HandleItemPropertyChanged(object?sender, PropertyChangedEventArgs e) { if (e.PropertyName == null) { Logger.Warning(Strings.BadINotifyPropertyChangedImplementation .InvariantFormat(typeof(T))); return; } var changedArgs = new CollectionPropertyChangedEventArgs(e.PropertyName); Changed?.Invoke(this, changedArgs); }
private void HandleCollectionChanged(object?sender, NotifyCollectionChangedEventArgs e) { // These collections are null when they are considered invalid for whatever reason. if (e.NewItems != null) { foreach (INotifyPropertyChanged newItem in e.NewItems) { newItem.PropertyChanged += HandleItemPropertyChanged; } } if (e.OldItems != null) { foreach (INotifyPropertyChanged oldItem in e.OldItems) { oldItem.PropertyChanged -= HandleItemPropertyChanged; } } var changedArgs = new CollectionPropertyChangedEventArgs((CollectionPropertyChangedAction)e.Action, e.NewItems, e.OldItems); Changed?.Invoke(this, changedArgs); }