Why don't WPF themes use SystemColors?

时光怂恿深爱的人放手 提交于 2019-12-01 09:29:36

I don't know about third-party themes, but the system colours are available in Xaml through the SystemColors class. This class exposes the keys of resources that can be used in your xaml in one of two ways:

<Border Background="{x:Static SystemColors.ControlDarkBrushKey}" />

or:

<Border Background="{StaticResource {x:Static SystemColors.ControlDarkBrushKey}}" />

Either of the above should give you a border with a background the same as the system's ControlDarkBrush colour. The documentation link I gave supplies the full list of available resources.

It's worth noting that SystemColors provides you with both a Brush for each colour available, and the colour itself - so if you want to create your own brush that fades from one system colour to another, you can create this easily.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!