开发者

WPF: How do I set a UI Element's background property to null/nothing/default in XAML?

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开发者_JAVA百科, I'm doing this in a Storyboard:

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


Give this a shot

<Storyboard>
    <ColorAnimation 
        Storyboard.TargetProperty="(Background).(SolidColorBrush.Color)" 
        Duration="00:00:02.00" 
        To="{x:Null}" />
</Storyboard>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜