Showing posts with label Custom Brush. Show all posts
Showing posts with label Custom Brush. Show all posts

Wednesday, July 25, 2007

"Cruel" colors substitution.

Sometime we need custom one or more brush of control in WPF. If template is not available and in base template used system brush, we can use this workaround (example for ListBox):
<ListBox>
<ListBox.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Maroon" />
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Maroon" />
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="White" />
<SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="White" />
</ListBox.Resources>
<ListBoxItem>blah-blah</ListBoxItem>
<ListBoxItem>blah-blah</ListBoxItem>
<ListBoxItem>blah-blah</ListBoxItem>
</ListBox>