This feels like the solution would be obvious, but apparently not.
I've got a listview on my window defined like so:
<ListView SelectedValue="{Binding Gender, ValidatesOnDataErrors=True}" Grid.Column="1" Grid.Row="3" SelectedValuePath="Tag" BorderThickness="0" Margin="2" SelectionMode="Single">
<RadioButton GroupName="Gender" Margin="2" Tag="M" Content="Male" IsChecked="{Binding RelativeSource={RelativeSource AncestorType=ListViewItem}, Path=IsSelected}"/>
<RadioButton GroupName="Gender" Margin="2" Tag="F" Content="Female" IsChecked="{Binding RelativeSource={RelativeSource AncestorType=ListViewItem}, Path=IsSelected}"/>
</ListView>
When one of those radio buttons is selected, it has a grey background and border around the item. I want to remove/hide the background and border. How do I do this?
I've tried setting Focusable
to false. Various styles, templates, triggers etc. but these have no effect. I tried all solutions from this question but they didn't work.
How else can I remove this styling on the list view items. Basically I want the grey background and border gone when the control doesn't have focus.
EDIT: Adding a picture to illustrate what I'm trying to achieve. I want the border and background around the 'Male' radiobutton removed/hidden. So this is what I have:
And this is what I want:
This is what I think should work (according to answers so far, but does nothing. The style just stays the same.)
<!-- This doesn't change the style... -->
<ListView.Resources>
<Style TargetType="ListViewItem">
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Background" Value="Transparent"/>
</Trigger>
</Style.Triggers>
</Style>
</ListView.Resources>
<!-- Neither does this... -->
<Style TargetType="{x:Type ListViewItem}">
<Style.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="True"/>
<Condition Property="IsFocused" Value="False"/>
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
<Setter Property="Foreground" Value="{x:Null}"/>
<Setter Property="Background" Value="{x:Null}"/>
<Setter Property="BorderBrush" Value="{x:Null}"/>
</MultiTrigger.Setters>
</MultiTrigger>
</Style.Triggers>
</Style>