Tony The Lion
Tony The Lion

Reputation: 63200

Implement INotifyPropertyChanged on DataContext in WPF?

When doing databinding does one have to implement INotifyPropertyChanged on the datacontext in WPF?

Upvotes: 1

Views: 2226

Answers (2)

Maurizio Reginelli
Maurizio Reginelli

Reputation: 3212

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.

Upvotes: 0

Matt Hamilton
Matt Hamilton

Reputation: 204169

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.

Upvotes: 4

Related Questions