如何禁用TreeView上的灰色焦点

时间:2012-08-06 02:31:12

标签: c# .net wpf treeview

  

可能重复:
  Change selected and unfocused Listbox style to not be grayed out

我只想将蓝色焦点保持在树视图上并禁用灰色焦点。如何在WPF中完成?

1 个答案:

答案 0 :(得分:1)

为了实现这一点,您需要在TreeViewItem的资源中替换系统控制笔刷,如下所示:

   <Style TargetType="TreeViewItem" x:Key="TreeViewItemStyle">
    <Style.Resources>
        <SolidColorBrush  x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Blue>"/>
    </Style.Resources>
   </Style>