NickLi

导航

x:static 标记扩展用法小结

1. <Button Content=”{x:Static sys:DateTime.Now}” />

2. 在MainWindow中设一个静态变量名为Now:

    <Button Content=”{x:Static local:MainWindow.Now}” />

    <Button Background=”{x:Static Brushes.AliceBlue}” />

3. <Button Background=”{DynamicResource

{x:Static SystemColors.ActiveCaptionBrushKey}}”>

Hello</Button>

4. 在Resources中设置静态值,在xaml中引用

<x:Static x:Key=”test” Member=”sys:DateTime.Now” />

<Button Content=”{StaticResource test}” />

5. <Button Content=”Hello”>

<Button.Foreground>

    <x:Static Member="SystemColors.ActiveCaptionBrush" />

</Button.Foreground>

    </Button>

posted on 2011-05-16 21:30  孤叶无眠  阅读(518)  评论(0编辑  收藏  举报