WPF ListView - how do i set selected item background colour?

background, listview, wpf

Solution

This will take care of the background color, maybe it will also help you find the solution for the foreground, this is from http://blogs.msdn.com/wpfsdk/archive/2007/08/31/specifying-the-selection-color-content-alignment-and-background-color-for-items-in-a-listbox.aspx

<Style TargetType="ListBoxItem">
    <Style.Resources>
        <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Green"/>
    </Style.Resources>
</Style>

Problem

I currently have this, but it only work for the foreground colour. Any help would be apriciated :D ``` <Style.Triggers> <Trigger Property="IsSelected" Value="true"> <Setter Property="Foreground" Value="Red" /> <Setter Property="Background" Value="Green"/> </Trigger> </Style.Triggers> ```

Original source