开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜