Pages

Friday 17 October 2008

ObservableCollection<T>.CollectionChanged

According to the documentation: "This event occurs when an item is added, removed, changed, moved or the entire list is refreshed."

However it does not occur if a property on an object in the collection changes, even if that object implements the INotifyPropertyChanged.

The new value of the object's property is reflected in the UI automatically (as you would expect of an ObservableCollection).

I wanted to know that something inside the collection had changed so that I could set a HasChanges property on the Model that the UI is bound to via its ObjectDataProvider. The intention was then to have a visual clue on the UI that was bound to the HasChanges property.

This posting doesn't have a solution, its simply a reminder not to try to use this event for this purpose in the future.

No comments: