Here I will post problems I and my colleagues met and solutions we found.

Tuesday, December 18, 2007

Changing background for selected item in WPF ListBox

When I wanted to change background color for WPF ListBox the first thing I did was creating triggers in the style:

The problem is that it doesn't work. I have to change resources instead. Here is the link that describes it very well.


http://blogs.msdn.com/wpfsdk/archive/2007/08/31/specifying-the-selection-color-content-alignment-and-background-color-for-items-in-a-listbox.aspx

1 comment:

Anonymous said...

Hi,

the trick is to override the SystemColors.HighlightBrushKey to either Transparent (no selected background) or the color you like.

Here is an article that explains excactly what you are searching for:

How to change the background color of a selected listbox item

Greetz
Christian