WPF:删除样式化列表框中的焦点项目周围的虚线边框 [英] WPF: Remove dotted border around focused item in styled listbox

查看:435
本文介绍了WPF:删除样式化列表框中的焦点项目周围的虚线边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义controlIemplate的水平列表框。所选项目在聚焦时获得虚线框。任何人都知道如何摆脱它?

解决方案

您需要将每个ListBoxItem的FocusVisualStyle设置为null。步骤如下:
$ b $ 1)为ListBox创建ItemContainerStyle

 < / p> ; Style x:Key =ListBoxItemStyle1TargetType ={x:Type ListBoxItem}> 
< Setter Property =FocusVisualStyleValue ={x:Null}/> ...

2)将该样式设置为Listbox

 < ListBox ItemContainerStyle ={DynamicResource ListBoxItemStyle1}


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?

解决方案

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}"

这篇关于WPF:删除样式化列表框中的焦点项目周围的虚线边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆