For the data binding to work in a collection is it necessary for the collection to implement the INotifyCollectionChanged (like using ObservableCollection) Also, as per the documentation the objects in the collection should implement the INotifyPropertyChanged interface to fully support transferring data values from source objects to targets.

However, if I derive my class only from the List<> and the objects in the List<> do not implement INotifyPropertyChanged, the data binding still works perfectly fine for me. I have a Master-detail data and on changing the master value the corresponding detail value gets changed.

Re: Windows Presentation Foundation (WPF) Data Binding in Collections

Marlon Grech


As far as I know, for data binding to work for a collection you must implement the INotifyCollectionChanged for the simple reason that this collection exposes an event that notifies the UI that there are items remove/inserted in the collection.

The INotifyPropertyChanged is used to notify the UI that a specific Property in the business logic objects has changed.

So databinding to a collection that implements the INotifyCollectionChanged (containing objects that do not implement the INotifyPropertyChanged and the properties are not dependency properties) will still work since the UI is notified that the objects in the collection are changing yet if the object values change the UI will not be notified since your object is not implementing the INotifyProperty changed.

You have to keep in ming that you are doing 2 binding!

1. You are binding the ItemSource to the collection
2. every object in the collection is being bound in the data template accordingly

I hope this makes things more clear...

fell free to ask any other question

P.S WPF Data binding ROCKS

Re: Windows Presentation Foundation (WPF) Data Binding in Collections


Thanks! Marlon. I guess I was getting confused between a simple data binding i.e. controls bound to some static data and a more dynamic binding where the data changes often.