Answer the question
In order to leave comments, you need to log in
How to create your own analogue of the SystemColors class?
Style is set via xaml
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="Background" Value="{DynamicResource {x:Static MyColors.ControlTextBrushKey}}"/>
Answer the question
In order to leave comments, you need to log in
<Window
xmlns:local="clr-namespace:MyCompany.Wpf.Example"
Background="{x:Static local:MyColors.ControlTextBrush}">
</Window>
namespace MyCompany.Wpf.Example
{
public static class MyColors
{
public static readonly Brush ControlTextBrush =
new SolidColorBrush(Colors.Red);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question