I have come across a lot of different examples about how to do this but none seem to work for me. I have a ListBox which has a list of items. Every time you hover over the an item in the list there is a transparent background and a border around the item. I want to get rid of this. This is what I have tried;
<Style TargetType="ListBoxItem">
<EventSetter Event="MouseDown" Handler="SitesListBox_MouseDown"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="White"></Setter>
<Setter Property="BorderBrush" Value="Transparent"></Setter>
<Setter Property="Background" Value="Transparent"></Setter>
</Trigger>
</Style.Triggers>
</Style>
The text colour changes fine but the Background and Border is not affected
not sure if this is what you want, but it seems to have the desired effect
<Style TargetType="ListBoxItem">
<EventSetter Event="MouseDown" Handler="SitesListBox_MouseDown"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="White"></Setter>
<Setter Property="Opacity" Value="0"/>
</Trigger>
</Style.Triggers>
</Style>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.