I have a ListView containing some ListViewItems. By default, selecting items makes their background to some deep blue. I would like to apply a style such that selecting an item does not change its look.
In my xaml I already achieved this:
<Style TargetType="ListViewItem">
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/>
</Style.Resources>
</Style>
Unfortunately, this does not do the trick. It just simply makes the selection white instead of blue.
Does anyone have an idea?
Best wishes, Christian
EDIT: Sample Code:
<Window.Resources>
<Style TargetType="ListViewItem">
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black"/>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/>
</Style.Resources>
</Style>
</Window.Resources>
<ListView x:Name="lvTestRun" ItemsSource="{Binding Path=TestRunData}" Margin="177,26,8,53.277" SelectionMode="Multiple">
<ListView.View>
<GridView>
<GridViewColumn Header="Status"/>
<GridViewColumn Header="Duration"/>
<GridViewColumn Header="Start Time"/>
<GridViewColumn Header="End Time"/>
</GridView>
</ListView.View>
</ListView>
In order to reproduce this, you may have to set the background color of a single ListViewItem to something like green or red.