WPF:属性更改时通知多个自定义控件
我们有一个特定的情况,即具有各种类型的自定义控件,当属性更改时它们必须做出不同的反应。
在 WPF 中处理此问题的最佳方法是什么?如果您有快速教程,我们将不胜感激。
谢谢
We have a specific case of having various type of custom controls that must react differently when a property change.
What would be the best way to handle this in WPF and if you have a quick tutorial, it would be appreciated.
Thx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
INotifyPropertyChanged
有什么问题?每个控件都可以订阅PropertyChanged
事件并以自己特定的方式对其做出反应What's wrong with
INotifyPropertyChanged
? Each control can subscribe to thePropertyChanged
event and react to it in its own specific way是的,在要将所有不同 UI 组件绑定到的对象上使用 INotifiyPropertyChanged 接口。这是msdn的示例:
http://msdn.microsoft.com/en-us/ Library/ms743695.aspx
尽情享受吧!
Yeah, use the INotifiyPropertyChanged interface on the object you are binding all of the different UI components to. here is msdn's example:
http://msdn.microsoft.com/en-us/library/ms743695.aspx
Enjoy!