WPF:删除聚焦 ListView 周围的虚线边框
WPF: Remove dotted border around focused ListView
当我的应用程序将状态更改为正常时,我想将焦点设置在我的 ListView
:
private void Window_StateChanged(object sender, EventArgs e)
{
if (WindowState == WindowState.Normal)
ListViewUsers.Focus();
}
我这样做是为了使用 Up & Down
箭头 Keys
来导航我的 ListViewItem
而不是先点击我的 ListView
来设置焦点。
所以这很好用,除了我的 ListView
.
周围有这个虚线边框
我尝试将此行添加到我的 ListViewItem Style
:
<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListViewItem}">
<Setter Property="FocusVisualStyle" Value="{x:Null}"/> ....
但不幸的是我仍然看到这个点border
。
有任何分段吗?
对我来说效果很好。
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
你是如何运用风格的?您确定 ListView
项使用此样式吗?
当我的应用程序将状态更改为正常时,我想将焦点设置在我的 ListView
:
private void Window_StateChanged(object sender, EventArgs e)
{
if (WindowState == WindowState.Normal)
ListViewUsers.Focus();
}
我这样做是为了使用 Up & Down
箭头 Keys
来导航我的 ListViewItem
而不是先点击我的 ListView
来设置焦点。
所以这很好用,除了我的 ListView
.
我尝试将此行添加到我的 ListViewItem Style
:
<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListViewItem}">
<Setter Property="FocusVisualStyle" Value="{x:Null}"/> ....
但不幸的是我仍然看到这个点border
。
有任何分段吗?
对我来说效果很好。
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
你是如何运用风格的?您确定 ListView
项使用此样式吗?