Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF: Remove dotted border around focused item in styled listbox

I have a horizontal listbox with a custom controlIemplate. The selected item gets a dotted frame when focused. Anyone know how to get rid of it?

like image 997
Vegar Avatar asked Feb 26 '09 22:02

Vegar


1 Answers

You need to set FocusVisualStyle of each ListBoxItem to null. Steps are bellow

1) Create ItemContainerStyle for the ListBox

<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}"> 
   <Setter Property="FocusVisualStyle" Value="{x:Null}"/> ....

2) Set that style to Listbox

<ListBox ItemContainerStyle="{DynamicResource ListBoxItemStyle1}"
like image 128
Jobi Joy Avatar answered Jan 05 '23 04:01

Jobi Joy