Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make highlight brush the same as control brush without specifying colour

I want to ensure that a selected ListViewItem's non-focused background is the same as the focused background. I know that the common way of doing this is as follows:

<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Blue"/>
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Blue"/>

However, the problem is that I don't want to specify a colour, I merely want the Brush returned by the static resource whose key is ControlBrushKey to be the same as the one for HighlightBrushKey.

like image 235
Chris Ward Avatar asked Sep 20 '10 17:09

Chris Ward


1 Answers

The answer is this:

<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" 
           Color="{DynamicResource {x:Static SystemColors.HighlightColorKey}}" />
like image 173
Chris Ward Avatar answered Oct 15 '22 02:10

Chris Ward