title: ListView Selected Item Style Override
body: <p>I have a WPF ListView that I'm trying to apply a custom style too... primarily I want to make the background of the listview box transparent with no border... and I want to override the highlighted and selected item styles.  The default highlight is a semi-transparent blue and the selected item is grey.  I'd like to override these in order to customize them.  I've followed several threads and tutorials... including this <a href="https://wpftutorial.net/ListBoxSelectionBackground.html" rel="nofollow noreferrer"><strong>one</strong></a> but, my highlight and selected items remain in the default style.  Here's what I have.</p>
  
  <pre><code>&lt;UserControl.Resources&gt;
      &lt;ResourceDictionary&gt;
          &lt;Style x:Key="ListViewStyle" TargetType="ListView"&gt;
              &lt;Setter Property="Background" Value="Transparent"&gt;&lt;/Setter&gt;
              &lt;Setter Property="BorderThickness" Value="0"&gt;&lt;/Setter&gt;
              &lt;Setter Property="BorderBrush" Value="Transparent"&gt;&lt;/Setter&gt;
              &lt;Style.Resources&gt;
                  &lt;SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Red" /&gt;
                  &lt;SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Green" /&gt;
              &lt;/Style.Resources&gt;
          &lt;/Style&gt;
      &lt;/ResourceDictionary&gt;
  &lt;/UserControl.Resources&gt;
  
  ....
  
  &lt;ListView Style="{StaticResource ListViewStyle}" ItemsSource="{Binding Path=Items}" ScrollViewer.VerticalScrollBarVisibility="Disabled" SelectedItem="{Binding Path=DataContext.Current" &gt;
      &lt;ListView.ItemTemplate&gt;
          &lt;DataTemplate DataType="local:Cases"&gt;
              &lt;StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch"&gt;
                  &lt;!-- Some UI Controls Here  --&gt;
              &lt;/StackPanel&gt;
          &lt;/DataTemplate&gt;
      &lt;/ListView.ItemTemplate&gt;
  &lt;/ListView&gt;
  </code></pre>