WPF ListBox: Setting Background Color of the Selected Item
March 22, 2011The trick to to overriding the default behavior of the selection color in list boxes is to provide custom brushes for pre-defined system resources.
This code snippet will do the trick:
<ListBox.Resources> <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Red" /> <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Green" /> </ListBox.Resources>