123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- <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>
- <HierarchicalDataTemplate x:Key="FolderTemplate" ItemsSource="{Binding Files}">
- <StackPanel Orientation="Horizontal" Tag="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}, Path=DataContext}">
- <Image x:Name="ExpandImage" Source="Folder_Close.png" Width="14" Height="12" Margin="2,0,0,0" VerticalAlignment="Center"/>
- <TextBlock Text="{Binding Name}" Margin="5,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left"/>
- <StackPanel.ContextMenu>
- <ContextMenu DataContext="{Binding Path=PlacementTarget.Tag, RelativeSource={RelativeSource Self}}">
- <MenuItem Header="新建菜单文件" Command="{Binding NewSequenceCommand}"></MenuItem>
- <Separator/>
- <MenuItem Header="新建文件夹" Command="{Binding NewFolderCommand}">
- </MenuItem>
- <MenuItem Header="删除文件夹" Command="{Binding DeleteFolderCommand}">
- </MenuItem>
- </ContextMenu>
- </StackPanel.ContextMenu>
- </StackPanel>
- <HierarchicalDataTemplate.Triggers>
- <Trigger Property="IsEnabled" Value="false">
- <Setter Property="Image.Source" TargetName="ExpandImage" Value="Folder_Unable.png"/>
- </Trigger>
- <!--<DataTrigger Binding="{Binding HasItems}" Value="True">
- <Setter Property="Image.Source" TargetName="ExpandImage" Value="Folder_Open.png"/>
- </DataTrigger>-->
- </HierarchicalDataTemplate.Triggers>
- </HierarchicalDataTemplate>
-
- <HierarchicalDataTemplate x:Key="FileTemplate" ItemsSource="{Binding Files}">
- <StackPanel Orientation="Horizontal" Tag="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}, Path=DataContext}">
- <Path Data="M0.5,5.125 L5.125,5.125 5.125,0.5 M5.1,0.5 L15.5,0.5 15.5,19.5 0.5,19.5 C0.5,14.7 0.5,10 0.5,5.1 2,3.6 3.6,2 5.1,0.5 z M8.1,8.5 L8.2,8.5 z M8.1,11.5 L8.2,11.5 z M8.1,14.5 L8.2,14.5 z" Fill="#FFF3F3F3" HorizontalAlignment="Left" Stretch="Fill" Stroke="#FF454545" Width="13" Height="16"/>
- <TextBlock Text="{Binding Name}" Margin="5,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left"/>
- <StackPanel.ContextMenu>
- <ContextMenu DataContext="{Binding Path=PlacementTarget.Tag, RelativeSource={RelativeSource Self}}">
- <MenuItem Header="另存为" Command="{Binding SaveAsCommand}">
- </MenuItem>
- <MenuItem Header="重命名菜单文件" Command="{Binding RenameCommand}">
- </MenuItem>
- <MenuItem Header="删除菜单文件" Command="{Binding DeleteSequenceCommand}">
- </MenuItem>
- </ContextMenu>
- </StackPanel.ContextMenu>
- </StackPanel>
- </HierarchicalDataTemplate>
- </ResourceDictionary>
|