I have a normal ListBox and I want to change the selection color to Red. Here's what I've got so far.
<Style x:Key="myLBStyle" TargetType="{x:Type ListBoxItem}">
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
Color="red" />
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}"
Color="red" />
</Style.Resources>
</Style>
It's working. The SelectedItem is Red and stay Red even if it's out of focus.
Here's my real problem: In my grid I also have a CheckBox and I want the above style to apply only if the CheckBox is checked.
So if the CheckBox is checked i want the selection color to be Red and to be Blue (or default color) if the CheckBox is unchecked.
I went through the web and i can't find anything, so i'm looking for help.