How do i set a style on the listbox to get a border around the selected item ?
The easiest way is to add a Trigger for IsSelected
in the ItemContainerStyle for the ListBox
<ListBox ...>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="BorderBrush" Value="Red"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="BorderThickness" Value="1"/>
</Trigger>
</Style.Triggers>
</Style>
</ListBox.ItemContainerStyle>
<!--...-->
</ListBox>
FocusVisualStyle may be what are you looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With