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>