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?
1 Answer
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}"
-
5This answer works great, but huge heads up here: If you use this method, your controls will not display any indicator of which is focused in Windows 8! With the
FocusVisualStyle
disabled in Windows 7, controls like Buttons still retains a blue overall highlight, but in Windows 8 it's completely impossible to tell which control in a group is focused. Jan 29, 2013 at 23:36 -
1Good to know. In this case the goal was to remove the visual style for a list item containing more controls. The child controls will still have its focus style intact.– VegarJun 11, 2013 at 8:56
-
3