I'm trying to make a ListBox where highlighted items look the same regardless of if the ListBox has focus or not.
Essentially I want to set the SystemColors.ControlBrushKey color property to be the same as the SystemColors.HighlightBrushKey color.
I thought I could use the following:
<ListBox>
<ListBox.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}"
Color="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
</ListBox.Resources>
</ListBox>
But this actually throws the following error:
System.Windows.Markup.XamlParseException: Set property 'System.Windows.Media.SolidColorBrush.Color' threw an exception. ---> System.ArgumentException: '#FF3399FF' is not a valid value for property 'Color'
If I set Color="#FF3399FF"
it works fine.
What am I doing wrong?