WPF: Remove dotted border around focused item in s

2019-01-08 09:00发布

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条回答
我只想做你的唯一
2楼-- · 2019-01-08 09:24

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}"
查看更多
登录 后发表回答