开发者

How do I clear the value set by SetCurrentValue in WPF?

开发者 https://www.devze.com 2023-03-28 18:22 出处:网络
For a DependencyProperty, I set a value using DependencyObject.SetC开发者_StackOverflow社区urrentValue(property, value). How does one unset the value so that the property evaluates to the normal local

For a DependencyProperty, I set a value using DependencyObject.SetC开发者_StackOverflow社区urrentValue(property, value). How does one unset the value so that the property evaluates to the normal local value again?


Calling InvalidateProperty will force the value to be reevaluated, and it appears to ignore the "current" value, so it effectively will unset it.


I don't believe you can 'unset' the value; you simply 'reset' the value to the previously saved value. If you dont have that, then you're OOL... -- Tejs

I do not think there is a way to do that, either. This method changes the value rather than adding an override in the ladder of precedences. Just get the value and store it somewhere before you overwrite it.

0

精彩评论

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