Remove Highlight Effect from ListViewItem
I don't know if this is the only solution but I did it as follows (by setting the Template
property of the ListViewItem
s):
<ListView.ItemContainerStyle> <Style TargetType="{x:Type ListViewItem}"> <Setter Property="Background" Value="Transparent" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListViewItem}"> <Border BorderBrush="Transparent" BorderThickness="0" Background="{TemplateBinding Background}"> <GridViewRowPresenter HorizontalAlignment="Stretch" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Width="Auto" Margin="0" Content="{TemplateBinding Content}"/> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style></ListView.ItemContainerStyle>
EDIT:
Or as Grant Winney suggests (I did not test that myself):
<ListView.ItemContainerStyle> <Style TargetType="{x:Type ListViewItem}"> <Setter Property="Background" Value="Transparent" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListViewItem}"> <ContentPresenter /> </ControlTemplate> </Setter.Value> </Setter> </Style></ListView.ItemContainerStyle>
This work:
<Style TargetType="{x:Type ListViewItem}"> <Setter Property="Background" Value="Transparent" /><Setter Property="BorderBrush" Value="Transparent"/><Setter Property="VerticalContentAlignment" Value="Center"/><Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListViewItem}"> <Grid Background="{TemplateBinding Background}"> <Border Name="Selection" Visibility="Collapsed" /> <!-- This is used when GridView is put inside the ListView --> <GridViewRowPresenter Grid.RowSpan="2" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> </Grid> </ControlTemplate> </Setter.Value></Setter>
For me, worked well, like this:
<ListView.ItemContainerStyle> <Style TargetType="ListViewItem"> <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="Transparent" /> <Setter Property="BorderThickness" Value="0" /> </Trigger> </Style.Triggers> </Style></ListView.ItemContainerStyle>