日期:2014-05-17 浏览次数:21017 次
<Style x:Key="styleTreeViewExpandCollapse" TargetType="{x:Type ToggleButton}">
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<TextBlock x:Name="icon" VerticalAlignment="Center" TextAlignment="Right" Text="+" Cursor="Hand"/>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="true">
<Setter TargetName="icon" Property="Text" Value="-" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="{Binding IsExpanded}"/>
<Setter Property="IsSelected" Value="false" />
<Setter Property="Template">
<Setter.Value>
&