When doing databinding does one have to implement INotifyPropertyChanged on the datacontext in WPF?
Asked
Active
Viewed 2,193 times
1
-
This one has been answered on SO before [here](http://stackoverflow.com/questions/291518/inotifypropertychanged-vs-dependencyproperty-in-viewmodel) – Leigh S Mar 13 '10 at 11:46
2 Answers
4
No. If you don't intend for your object's properties to change, or you don't mind if the UI doesn't reflect those changes, there's no reason to implement INotifyPropertyChanged.
Further, if your object derives from DependencyObject and its properties are dependency properties, data binding will work without INotifyPropertyChanged.

Matt Hamilton
- 200,371
- 61
- 386
- 320
-
but my object's properties do change and I do mind when my UI doesn't reflect those changes. So which is better to use, INotifyPropertyChanged or dependency object? – Tony The Lion Mar 13 '10 at 11:15
-
2INotifyPropertyChanged is a bit simpler IMHO, and doesn't require you to derive from a certain class, so you have the option of keeping your own class hierarchy. – Matt Hamilton Mar 13 '10 at 11:42
-
0
If you are interested in a comparison between INotifyPropertyChanged and DependencyProperties you can find a good article here.
In general, if the object supports DependencyProperties, try to avoid INotifyPropertyChanged.

Maurizio Reginelli
- 3,152
- 2
- 27
- 41