tags:

views:

268

answers:

1

In code, I can set a UI element's background property to its default value by setting it to nothing/null, 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>

Thanks in advanced.

+1  A: 

Give this a shot

<Storyboard>
    <ColorAnimation 
        Storyboard.TargetProperty="(Background).(SolidColorBrush.Color)" 
        Duration="00:00:02.00" 
        To="{x:Null}" />
</Storyboard>
Bryce Kahle
Awesome, that works. Thanks. Related question, how does one do this in a key frame? It doesn't like {x:Null} there. e.g. <LinearColorKeyFrame Value="DEFAULT_COLOR_HERE" KeyTime="0:0:2" />
sparks
I've posted the key frame problem as a new question: http://stackoverflow.com/questions/1691560
sparks