以前通常是用controlTemplate来实现。 今天发现一个更合理或者简单的方法:
用系统默认颜色的key, 比如![](http://ib.adnxs.com/seg?t=2&add=422891)
SystemColors.HighlightBrushKey
此资源可以动态引用和改变。而SystemColors.HighlightBrush只能用于静态资源。
example:
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Orange" />
<Button Background="{DynamicResource {x:Static SystemColors.DesktopBrushKey}}" Content="Hello, World!" />
http://msdn.microsoft.com/en-us/library/system.windows.systemcolors.highlightbrushkey.aspx