I am trying to have rounded corners for the highlight and selected background of the ListViewItem
I have the following code:
<LinearGradientBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" StartPoint="0,0" EndPoint="0,1">
<LinearGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#F7D073" Offset="0"/>
<GradientStop Color="#F1A62F" Offset="1"/>
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="{x:Static SystemColors.ControlBrushKey}" StartPoint="0,0" EndPoint="0,1">
<LinearGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#F7D073" Offset="0"/>
<GradientStop Color="#F1A62F" Offset="1"/>
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="MouseOverBrush" StartPoint="0,0" EndPoint="0,1">
<LinearGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#E4F0FD" Offset="0"/>
<GradientStop Color="#D7EAFD" Offset="1"/>
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="Foreground">
<Setter.Value>
<SolidColorBrush Color="{Binding Path=NGGDataForeground, ElementName=NGG}" />
</Setter.Value>
</Setter>
<Setter Property="FontWeight" Value="Normal" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Background" Value="{StaticResource MouseOverBrush}" />
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Foreground" Value="Black" />
</Trigger>
</Style.Triggers>
<Style.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Style.Resources>
</Style>
<ListView x:Name="lstData" ItemsSource="{Binding ElementName=NGG}"
Height="{Binding Path=GridHight, ElementName=NGG}"
Width="{Binding Path=GridWidth, ElementName=NGG}"
BorderThickness="0" BorderBrush="Transparent">
</ListView>
However for some reason this only rounds the left side and not the right looking for help on how to round all 4 corners.
If I use the above XAML on a new Window, it works fine for me:
Could it be possible that the right side of your ListView is not displayed as expected? Maybe the bound GridWidth is a little bit bigger than the control on which it is placed.