A more complete solution would be to make the new brush reference HighlightColor:
<Style TargetType="ListBox"> <Setter Property="ItemContainerStyle"> <Setter.Value> <Style TargetType="ListBoxItem"> <Style.Resources> <SolidColorBrush x:Key="{x:Static Member=SystemColors.InactiveSelectionHighlightBrushKey}" Color="{DynamicResource ResourceKey={x:Static Member=SystemColors.HighlightColorKey}}" /> </Style.Resources> </Style> </Setter.Value> </Setter> </Style>
This ensures that it uses the same color and matches the system theme (even if the system theme changes at runtime thanks to DynamicResource).
By the way, it seems that recent versions of WPF no longer use "ControlBrush" for this, but a more suitable "InactiveSelectionHighlightBrush".
nmclean 04 Oct '13 at 13:22 2013-10-04 13:22
source share