C# 我需要删除WPF中radtreeview的突出显示

C# 我需要删除WPF中radtreeview的突出显示,c#,wpf,telerik,styles,radtreeview,C#,Wpf,Telerik,Styles,Radtreeview,这是我的密码。我只需要把radtreeview的亮点去掉。我只会像在其他应用程序中一样使用IshitteVisible,但它不允许我单击触发器来扩展节点。 任何帮助都将不胜感激 <telerik:RadTreeView x:Name="radTreeView" Margin="8" ItemsSource="{Binding Errors}" Background="Salmon" IsHitTestVisible="True" IsDropPreviewLineEnabled="Fal

这是我的密码。我只需要把radtreeview的亮点去掉。我只会像在其他应用程序中一样使用IshitteVisible,但它不允许我单击触发器来扩展节点。 任何帮助都将不胜感激

 <telerik:RadTreeView x:Name="radTreeView" Margin="8" ItemsSource="{Binding Errors}" Background="Salmon" IsHitTestVisible="True" IsDropPreviewLineEnabled="False" IsDragTooltipEnabled="False" Focusable="False">
            <telerik:RadTreeView.ItemTemplate>
                 <HierarchicalDataTemplate ItemsSource="{Binding SubItems}" >
                    <Grid Background="Salmon">
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>

                        </Grid.RowDefinitions>
                        <TextBlock Text="{Binding Description}" IsHitTestVisible="False" />

                        <ListBox Grid.Row="1" ItemsSource="{Binding Messages}" Margin="20,0,0,0" BorderBrush="#00000000" BorderThickness="0" Background="Salmon" IsHitTestVisible="False" >
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Message}"/>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </Grid>

                </HierarchicalDataTemplate>

            </telerik:RadTreeView.ItemTemplate>
        </telerik:RadTreeView>

从不同的角度接近它。您应该尝试在TreeView项目上更改以下内容:

  • SystemColor.HighlightBrushKey
  • SystemColor.HighlightTextBrushKey
例如:

<Style TargetType="TreeViewItem">
      <Style.Resources>
          <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#FFF"/>
          <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="#000"/>
     </Style.Resources>  
</Style>


这也适用于Rad控制。您只需调整RadtreeView项目。

从不同角度接近它。您应该尝试在TreeView项目上更改以下内容:

  • SystemColor.HighlightBrushKey
  • SystemColor.HighlightTextBrushKey
例如:

<Style TargetType="TreeViewItem">
      <Style.Resources>
          <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="#FFF"/>
          <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="#000"/>
     </Style.Resources>  
</Style>


这也适用于Rad控制。您只需调整RadTreeViewItem即可。

我应该在代码中的具体位置添加此项??当我添加它时,异常“在使用ItemsSource之前Items集合必须为空”。我想我已经正确地实现了它,但它仍然没有取消突出显示。您是否确保更改TargetType?我应该在代码中的具体位置添加它??当我添加它时,异常“在使用ItemsSource之前Items集合必须为空”。我想我已经正确地实现了它,但它仍然没有取消突出显示。您确定要更改TargetType吗?