Search code examples
wpfdependency-propertiessetcurrentvalue

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


For a DependencyProperty, I set a value using DependencyObject.SetCurrentValue(property, value). How does one unset the value so that the property evaluates to the normal local value again?


Solution

  • 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.