Could someone explain the use of notify property changed and in which cases should I be using it?
For example: I have in my silverlight application the domain data source which loads data and the event LoadedData where I set to some lists (List) the content of the entities from the domain context and bind the lists to the girds.
Do I need to use NotyfiPropertyChanged on the Lists?
Thanks,
I think you are getting the concepts slightly confused here...
There are two relevant notification interfaces for use with XAML Binding technologies.
INotifyCollectionChanged
- notifies listeners when the collection of items changes (as in add/remove/replace/reorder actions).INotifyPropertyChanged
- notifies listeners that the content of an object has changed (as in values have been set and itself and other properties have changed).In your case, if you want to notify that the contents of the
List
have changed, you need to use anINotifyCollectionChanged
enabled collection to do that (i.e. notList
- typicallyObservableCollection
).If you wanted to notify that an item within the
List
has changed then the object type contained in theList
should implementINotifyPropertyChanged
.