The WPF TextBox
natively makes use of the System Highlight color for painting the background of selected text. I would like to override this and make it consistent since it varies by OS/user theme.
For ListBoxItem
s, there is a neat trick (see below) where you can override the resource key for the HighlightBrushKey
to customize the System Highlight color in a focused setting:
<Style TargetType="ListBoxItem">
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
Color="LightGreen"/>
</Style.Resources>
</Style>
The same trick does not work for the TextBox
unfortunately. Does anyone have any other ideas, besides "override the ControlTemplate
"?