有什么方法可以判断是否正在订阅依赖属性?
我有一个自定义控件,其依赖属性的计算成本相当昂贵。因此,除非有人真正对此感兴趣,否则我不想这样做。
WPF 是否提供任何方式来查看是否有任何内容正在查看依赖属性?
I have a custom control with a dependency property that is fairly expensive to compute. Therefore I don't want to do so unless someone is actually interested in it.
Does WPF supply any way of seeing if anything is looking at a dependency property?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有多种方法可以阻止对 DP 的绑定生效(即在执行昂贵的计算之前),这就是验证回调...
http://msdn.microsoft.com/en-us/library/ms745795.aspx#Validation_Callbacks。
There are ways to stop a Binding to a DP from taking effect (i.e. before performing your expensive computation), and that is the Validation callback ...
http://msdn.microsoft.com/en-us/library/ms745795.aspx#Validation_Callbacks.