Question

Using code, I can set a UI element's background property to its default value by setting it to nothing, i.e.

myControl.Background = Nothing

But how do I do this in XAML? In particular, I'm doing this in a Storyboard:

<Storyboard>
    <ColorAnimation 
        Storyboard.TargetProperty="(Background).(SolidColorBrush.Color)" 
        Duration="00:00:02.00" 
        To="DEFAULT_COLOR_HERE" />
</Storyboard>
Was it helpful?

Solution

Give this a shot

<Storyboard>
    <ColorAnimation 
        Storyboard.TargetProperty="(Background).(SolidColorBrush.Color)" 
        Duration="00:00:02.00" 
        To="{x:Null}" />
</Storyboard>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top