How to change listbox, combobox or listview selection and background color
This is, probably, one of most common questions about styling in WPF – how to change selected item background color in ListBox (ComboBox, ListView etc). The answer is really simple – look into default control templates of those controls. Those templates using system brushed in order to paint background colors. So, if you want to customize an appearance of those controls, you always can rewrite templates, but why to do it if the only thing you want is to change color brush of elements, so KISS [keep it stupid simple] rewrite those system brushed like this:
<ComboBox Background=“Red“>
<ComboBox.Resources>
<SolidColorBrush x:Key=“{x:Static SystemColors.HighlightBrushKey}“ Color=“Yellow“ />
<SolidColorBrush x:Key=“{x:Static SystemColors.ControlBrushKey}“ Color=“Green“ />
<SolidColorBrush x:Key=“{x:Static SystemColors.WindowBrushKey}“ Color=“Red“ />
</ComboBox.Resources>
<TextBlock>TEST</TextBlock>
<TextBlock>TEST</TextBlock>
<TextBlock>TEST</TextBlock>
<TextBlock>TEST</TextBlock>
<TextBlock>TEST</TextBlock>
<TextBlock>TEST</TextBlock>
<TextBlock>TEST</TextBlock>
</ComboBox>
That’s all, folks. Now you have you own colored combo, that looks like this:

April 9th, 2007 · Comments (4)
4 Responses to “How to change listbox, combobox or listview selection and background color”
Leave a Reply
Discover other tags
My tools
- .NET Framework Detector
- Duplicate images finder
- Exchange Security Policy for Windows Mobile Devices Fix
- Gas Price Windows Vista SideBar gadget
- Israel Traffic Information Windows Vista SideBar gadget
- Localization fix for SAP ES Explorer for Visual Studio
- LocTester
- RTL and LTR in Windows Live Writer
- Silverlight controls library
- Snipping tool integration plugin for WLW
- USB FM receiver library
- Vista Battery Saver
- WebCam control for WPF
- Windows Live SkyDrive attachment for Windows Live Writer
- Wireless Migrator
- WPF Virtual Keyboard




January 1st, 2009 at 12:09 am
Priceless for TreeView
January 1st, 2009 at 12:09 am
thanks for helping me
January 1st, 2009 at 12:09 am
Very clever approach, tank you
January 1st, 2009 at 12:09 am
Yes, thank you! Been beating my head against it a couple days now. You mentioned examining the default control templates; are those in the new SDK downloads or somewhere like that? I’d definitely like to know where those are as I try to learn this stuff.