123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- <ResourceDictionary
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- mc:Ignorable="d">
- <SolidColorBrush x:Key="TreeView_BG_MouseOver" Color="#FFD6DCE5"/>
- <SolidColorBrush x:Key="TreeView_BG_Select" Color="#FF47A2E7"/>
- <Style x:Key="TreeViewItemFocusVisual"/>
- <PathGeometry x:Key="TreeArrow" Figures="M0,0 L0,6 L6,0 z"/>
- <Style x:Key="ExpandCollapseToggleStyle" TargetType="{x:Type ToggleButton}">
- <Setter Property="Focusable" Value="False"/>
- <Setter Property="Width" Value="16"/>
- <Setter Property="Height" Value="16"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ToggleButton}">
- <Border Background="#00FFFFFF" Width="16" Height="16" Padding="3,0" Cursor="Hand">
- <Grid>
- <Grid Background="Black" Margin="-5" Opacity="0"/>
- <Path x:Name="ExpandPath" Fill="Gray" Data="{StaticResource TreeArrow}" HorizontalAlignment="Left" VerticalAlignment="Center">
- <Path.RenderTransform>
- <RotateTransform Angle="135" CenterX="3" CenterY="3"/>
- </Path.RenderTransform>
- </Path>
- </Grid>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter Property="Fill" TargetName="ExpandPath" Value="#FFFFBB00"/>
- </Trigger>
- <Trigger Property="IsChecked" Value="True">
- <Setter Property="RenderTransform" TargetName="ExpandPath">
- <Setter.Value>
- <RotateTransform Angle="180" CenterX="3" CenterY="3"/>
- </Setter.Value>
- </Setter>
- <Setter Property="Fill" TargetName="ExpandPath" Value="Black"/>
- </Trigger>
- <Trigger Property="IsEnabled" Value="false">
- <Setter Property="Fill" TargetName="ExpandPath" Value="#FF9A9A9A"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="{x:Type TreeViewItem}" TargetType="{x:Type TreeViewItem}">
- <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
- <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
- <Setter Property="Padding" Value="1,0,0,0"/>
- <Setter Property="FontFamily" Value="Arial"/>
- <Setter Property="Background" Value="{DynamicResource TreeView_BG_MouseOver}"/>
- <Setter Property="Foreground" Value="{DynamicResource FG_Black}"/>
- <Setter Property="FocusVisualStyle" Value="{StaticResource TreeViewItemFocusVisual}"/>
- <Setter Property="FontSize" Value="16"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type TreeViewItem}">
- <Grid SnapsToDevicePixels="true">
- <Grid.ColumnDefinitions>
- <ColumnDefinition MinWidth="16" Width="Auto"/>
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition Width="*"/>
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" MinHeight="24"/>
- <RowDefinition/>
- </Grid.RowDefinitions>
- <Border x:Name="Text_BG" Grid.ColumnSpan="3" Background="{TemplateBinding Background}" Margin="-2,2,1,1" Opacity="0"/>
- <ToggleButton x:Name="Expander" Style="{StaticResource ExpandCollapseToggleStyle}" ClickMode="Press" IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"/>
- <Grid x:Name="TreeViewHeader" Grid.Column="1" HorizontalAlignment="Left" Cursor="Hand">
- <ContentPresenter x:Name="PART_Header" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Header" VerticalAlignment="Center" Margin="2,0,5,0"/>
- </Grid>
- <ItemsPresenter x:Name="ItemsHost" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="1" Grid.RowSpan="1"/>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" SourceName="TreeViewHeader" Value="True">
- <Setter Property="Opacity" TargetName="Text_BG" Value="1"/>
- <Setter Property="Foreground" Value="{DynamicResource FG_Blue}"/>
- </Trigger>
- <Trigger Property="IsSelected" Value="True">
- <Setter Property="BorderThickness" TargetName="Text_BG" Value="0"/>
- <Setter Property="Opacity" TargetName="Text_BG" Value="1"/>
- <Setter Property="Foreground" Value="{DynamicResource FG_White}"/>
- <Setter Property="Background" TargetName="Text_BG" Value="{DynamicResource TreeView_BG_Select}"/>
- </Trigger>
- <Trigger Property="IsExpanded" Value="false">
- <Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed"/>
- </Trigger>
- <Trigger Property="HasItems" Value="false">
- <Setter Property="Visibility" TargetName="Expander" Value="Hidden"/>
- </Trigger>
- <Trigger Property="IsEnabled" Value="false">
- <Setter Property="Foreground" Value="#FF9A9A9A"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- <Style.Triggers>
- <Trigger Property="VirtualizingStackPanel.IsVirtualizing" Value="true">
- <Setter Property="ItemsPanel">
- <Setter.Value>
- <ItemsPanelTemplate>
- <VirtualizingStackPanel/>
- </ItemsPanelTemplate>
- </Setter.Value>
- </Setter>
- </Trigger>
- </Style.Triggers>
- </Style>
- <Style x:Key="TreeView-SecondFloor" TargetType="{x:Type TreeViewItem}" BasedOn="{StaticResource {x:Type TreeViewItem}}">
- <Setter Property="FontSize" Value="14"/>
- </Style>
- <Style x:Key="{x:Type TreeView}" TargetType="{x:Type TreeView}">
- <Setter Property="Background" Value="Transparent"/>
- <Setter Property="OverridesDefaultStyle" Value="True"/>
- <Setter Property="SnapsToDevicePixels" Value="True"/>
- <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
- <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
- <Setter Property="Template">
- <Setter.Value >
- <ControlTemplate TargetType="{x:Type TreeView}" >
- <Border x:Name = "Border" CornerRadius="1" BorderThickness="1">
- <ScrollViewer Focusable="False" CanContentScroll="False" Padding="4">
- <ItemsPresenter/>
- </ScrollViewer>
- </Border>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="TreeViewItemExtend" TargetType="{x:Type TreeViewItem}">
- <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
- <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
- <Setter Property="Padding" Value="1,0,0,0"/>
- <Setter Property="FontFamily" Value="Arial"/>
- <Setter Property="Background" Value="{DynamicResource TreeView_BG_MouseOver}"/>
- <Setter Property="Foreground" Value="{DynamicResource FG_Black}"/>
- <Setter Property="FocusVisualStyle" Value="{StaticResource TreeViewItemFocusVisual}"/>
- <Setter Property="FontSize" Value="16"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type TreeViewItem}">
- <Grid SnapsToDevicePixels="true">
- <Grid.ColumnDefinitions>
- <ColumnDefinition MinWidth="16" Width="Auto"/>
- <ColumnDefinition Width="Auto"/>
- <ColumnDefinition Width="*"/>
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto" MinHeight="24"/>
- <RowDefinition/>
- </Grid.RowDefinitions>
- <Border x:Name="Text_BG" Grid.Column="1" Background="{TemplateBinding Background}" Margin="-2,2,1,1" Opacity="0"/>
- <ToggleButton x:Name="Expander" Style="{StaticResource ExpandCollapseToggleStyle}" ClickMode="Press" IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"/>
- <Grid x:Name="TreeViewHeader" Grid.Column="1" HorizontalAlignment="Left" Cursor="Hand">
- <ContentPresenter x:Name="PART_Header" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Header" VerticalAlignment="Center" Margin="2,0,5,0"/>
- </Grid>
- <ItemsPresenter x:Name="ItemsHost" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="1" Grid.RowSpan="1"/>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" SourceName="TreeViewHeader" Value="True">
- <Setter Property="Opacity" TargetName="Text_BG" Value="1"/>
- <Setter Property="Foreground" Value="{DynamicResource FG_Blue}"/>
- </Trigger>
- <Trigger Property="IsSelected" Value="True">
- <Setter Property="FontWeight" Value="Bold"></Setter>
- <Setter Property="BorderThickness" TargetName="Text_BG" Value="0"/>
- <Setter Property="Opacity" TargetName="Text_BG" Value="1"/>
- <Setter Property="Background" TargetName="Text_BG" Value="{DynamicResource TreeView_BG_Select}"/>
- </Trigger>
- <Trigger Property="IsExpanded" Value="false">
- <Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed"/>
- </Trigger>
- <Trigger Property="HasItems" Value="false">
- <Setter Property="Visibility" TargetName="Expander" Value="Hidden"/>
- </Trigger>
- <Trigger Property="IsEnabled" Value="false">
- <Setter Property="Foreground" Value="#FF9A9A9A"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- <Style.Triggers>
- <Trigger Property="VirtualizingStackPanel.IsVirtualizing" Value="true">
- <Setter Property="ItemsPanel">
- <Setter.Value>
- <ItemsPanelTemplate>
- <VirtualizingStackPanel/>
- </ItemsPanelTemplate>
- </Setter.Value>
- </Setter>
- </Trigger>
- </Style.Triggers>
- </Style>
- </ResourceDictionary>
|