![](/img/trans.png)
[英]Is there a *clean* way to make a read-only dependency-property reflect the value of another property?
[英]Is it possible to “cancel” a dependency-property assignment from an IValueConverter, if there was no change in the property value?
我在類的依賴項屬性上有一個數據綁定集。 我還有一個IValueConverter來處理基於其他元素的這個值的計算。 我的問題的上下文在IValueConverter.Convert方法中。
#1
如果計算的返回值等於當前屬性值,我可以告訴框架不要打擾SetValue,因為沒有邏輯更改嗎? 或者框架會自動檢測到這個,而不是浪費時間在內部設置屬性?
#2
如果計算的返回值對於此屬性無效,我是否可以告訴框架將屬性保留為其當前值,而不是將其設置為DependencyProperty.UnsetValue?
請參閱Binding.DoNothing
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.