I tried multiple times to remove that kind of white glossy effect in wpf, But even when changing everything to #1F419A I still have that white thing. Top of the selection white Is there a way to fix this? kind regards LD
<ListView.Resources>
<Style TargetType="{x:Type ListViewItem}">
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#1F419A"/>
<Setter Property="BorderBrush" Value="#1F419A"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#1F419A"/>
<Setter Property="BorderBrush" Value="#1F419A"/>
</Trigger>
</Style.Triggers>
</Style>
</ListView.Resources>
This is what I tried, I expected all to be in that color
The highlight effects and other layout details like background elements are always implemented in the ControlTemplate
. In order to change it you would have to override the default ControlTemplate
and add your triggers to the ControlTemplate.Triggers
collection. You can find an example of the default templates at Microsoft Docs: Control Styles and Templates.
<Style x:Key="{x:Type ListViewItem}"
TargetType="ListViewItem">
<Setter Property="SnapsToDevicePixels"
Value="true" />
<Setter Property="OverridesDefaultStyle"
Value="true" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border x:Name="Border"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<GridViewRowPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Border"
Property="Background"
Value="#1F419A" />
<Setter TargetName="Border"
Property="BorderBrush"
Value="#1F419A" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Border"
Property="Background"
Value="#1F419A" />
<Setter TargetName="Border"
Property="BorderBrush"
Value="#1F419A" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>