Implement INotifyPropertyChanged on DataContext in WPF?
When doin开发者_StackOverflow社区g databinding does one have to implement INotifyPropertyChanged on the datacontext in WPF?
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.
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.
精彩评论