展开全部
<Window x:Class="TreeViewSelectRed.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<Style TargetType="TreeViewItem">
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid>
<TreeView FontSize="16">
<TreeView.Items>
<TreeViewItem Header="a">
<TreeViewItem>a1</TreeViewItem>
<TreeViewItem>a2</TreeViewItem>
</TreeViewItem>
<TreeViewItem Header="b">
<TreeViewItem>b1</TreeViewItem>
<TreeViewItem>b2</TreeViewItem>
</TreeViewItem>
</TreeView.Items>
</TreeView>
</Grid>
</Window>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询