ObservableCollection
implements both INotifyCollectionChanged
and INotifyPropertyChanged
.
I understand that additions, deletions (+ clear), and replacement of items are notifiable to consumers through the collection's event
CollectionChanged
, and that updates in the existing items can be monitored using the items' eventPropertyChanged
if they implement themselves INotifyPropertyChanged.I read from others that you can't register on the collection's event PropertyChanged because it is readonly.
So what is its purpose, what utilization can we do of it?
The comments here and there seem to make the discussion confused by implying that the magic of ObservableCollection is to implement both interfaces, allowing to be notified both for collection and items content changes, while this is not correct (this is fuelled by many examples where the collection is bound to a listbox which updates magically after items content is changed, suggesting the collection notifies the listbox).
Actually it seems the only superiority of the collection is to implement INotifyCollectionChanged. Dealing with items property changes seems not at all easier with ObservableCollection than with another collection: it is possible only if the items implements INotifyPropertyChanged, which they may not do, and if the user manages to hook on this event independently of the collection.
Is this correct?