Can you clear a dependency property in a trigger? [duplicate]
Possible Duplicate:
Is it possible to use a setter to return a property to its default value?
Ok... I know in code-behind, I can call ClearValue to clear, or 'unset' a dependency property, and of course I know I can set a dependency property in a trigger, but (.开发者_如何学C..and I'm sure you can see where this is going...) can you use a trigger to clear a value!?
Now I've asked several of my co-workers and they just keep saying 'Set it to null!' but that is NOT the same thing, as you wouldn't be clearing the DP, you'd be setting the DP to null! Not the same thing!
So... how do you clear a DP in a trigger?! My thought is to just write a XAML extension to do it for me (can't use a converter as that just returns the value) but I'm hoping the good ol' folks at MS have already thought of this!
So any takers?
Did you consider writing a TriggerAction? Perhaps using the Blend SDK you could use an Interaction (see same article) as well and skip the trigger.
精彩评论