更新
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:WPFluent.Controls"
|
||||
xmlns:conv="clr-namespace:WPFluent.Converters"
|
||||
xmlns:layout="clr-namespace:WPFluent.Layout"
|
||||
xmlns:controls="clr-namespace:WPFluent.Controls">
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/WPFluent;component/Controls/TreeView/TreeViewItem.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/WPFluent;component/Resources/DefaultControlFocusVisualStyle.xaml" />
|
||||
<!--<ResourceDictionary Source="pack://application:,,,/WPFluent;component/Themes/Light.xaml" />-->
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<conv:TreeLevelToIndentConverter x:Key="TreeLevelToIndentConverter" />
|
||||
<FontFamily x:Key="SymbolThemeFontFamily">pack://application:,,,/WPFluent;component/Resources/Fonts/Segoe Fluent Icons.ttf#Segoe Fluent Icons</FontFamily>
|
||||
|
||||
<Style x:Key="TreeExpandCollapseToggleStyle" TargetType="{x:Type ToggleButton}">
|
||||
<Style TargetType="{x:Type ToggleButton}" x:Key="TreeExpandCollapseToggleStyle">
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource DefaultControlFocusVisualStyle}" />
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="OverridesDefaultStyle" Value="True" />
|
||||
@@ -19,19 +21,19 @@
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||||
<Grid
|
||||
x:Name="ChevronContainer"
|
||||
Width="15"
|
||||
Height="15"
|
||||
Background="Transparent"
|
||||
RenderTransformOrigin="0.5, 0.5">
|
||||
Height="15"
|
||||
RenderTransformOrigin="0.5, 0.5"
|
||||
Width="15"
|
||||
x:Name="ChevronContainer">
|
||||
<Grid.RenderTransform>
|
||||
<RotateTransform Angle="0" />
|
||||
</Grid.RenderTransform>
|
||||
<controls:SymbolIcon
|
||||
x:Name="ChevronIcon"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="{StaticResource TreeViewItemChevronSize}"
|
||||
Symbol="ChevronRight28" />
|
||||
Symbol="ChevronRight28"
|
||||
VerticalAlignment="Center"
|
||||
x:Name="ChevronIcon" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
@@ -39,10 +41,10 @@
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation
|
||||
Duration="0:0:0.16"
|
||||
Storyboard.TargetName="ChevronContainer"
|
||||
Storyboard.TargetProperty="(Grid.RenderTransform).(RotateTransform.Angle)"
|
||||
To="90"
|
||||
Duration="0:0:0.16" />
|
||||
To="90" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</Trigger.EnterActions>
|
||||
@@ -50,10 +52,10 @@
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation
|
||||
Duration="0:0:0.16"
|
||||
Storyboard.TargetName="ChevronContainer"
|
||||
Storyboard.TargetProperty="(Grid.RenderTransform).(RotateTransform.Angle)"
|
||||
To="0"
|
||||
Duration="0:0:0.16" />
|
||||
To="0" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</Trigger.ExitActions>
|
||||
@@ -64,35 +66,35 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="DefaultTreeRowExpanderStyle" TargetType="{x:Type controls:TreeRowExpander}">
|
||||
<Style TargetType="{x:Type controls:TreeRowExpander}" x:Key="DefaultTreeRowExpanderStyle">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:TreeRowExpander}">
|
||||
<layout:Grid VerticalAlignment="Center" ColumnDefinitions="Auto,*">
|
||||
<layout:Grid ColumnDefinitions="Auto,*" VerticalAlignment="Center">
|
||||
<ToggleButton
|
||||
x:Name="Expander"
|
||||
Grid.Column="0"
|
||||
Margin="{Binding Path=Level, Converter={StaticResource TreeLevelToIndentConverter}, RelativeSource={RelativeSource AncestorType={x:Type controls:TreeListViewItem}}}"
|
||||
ClickMode="Press"
|
||||
Grid.Column="0"
|
||||
IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource AncestorType={x:Type controls:TreeListViewItem}}}"
|
||||
Style="{StaticResource TreeExpandCollapseToggleStyle}" />
|
||||
Margin="{Binding Path=Level, Converter={StaticResource TreeLevelToIndentConverter}, RelativeSource={RelativeSource AncestorType={x:Type controls:TreeListViewItem}}}"
|
||||
Style="{StaticResource TreeExpandCollapseToggleStyle}"
|
||||
x:Name="Expander" />
|
||||
<ContentPresenter
|
||||
Content="{TemplateBinding Content}"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{TemplateBinding Content}"
|
||||
TextElement.FontSize="{TemplateBinding FontSize}"
|
||||
TextElement.Foreground="{TemplateBinding Foreground}" />
|
||||
TextElement.Foreground="{TemplateBinding Foreground}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
|
||||
</layout:Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding Path=HasItems, RelativeSource={RelativeSource AncestorType={x:Type controls:TreeListViewItem}}}" Value="false">
|
||||
<Setter TargetName="Expander" Property="Visibility" Value="Hidden" />
|
||||
<Setter Property="Visibility" TargetName="Expander" Value="Hidden" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource AncestorType={x:Type controls:TreeListViewItem}}}" Value="true">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonForeground}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
|
||||
</DataTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
@@ -102,10 +104,10 @@
|
||||
|
||||
<Style BasedOn="{StaticResource DefaultTreeRowExpanderStyle}" TargetType="{x:Type controls:TreeRowExpander}" />
|
||||
|
||||
<Style x:Key="DefaultTreeListViewItemStyle" TargetType="{x:Type controls:TreeListViewItem}">
|
||||
<Style TargetType="{x:Type controls:TreeListViewItem}" x:Key="DefaultTreeListViewItemStyle">
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource DefaultControlFocusVisualStyle}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TreeViewItemForeground}" />
|
||||
<Setter Property="Background" Value="{DynamicResource TreeViewItemBackground}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
|
||||
<Setter Property="Background" Value="{DynamicResource SubtleFillColorTransparentBrush}" />
|
||||
<Setter Property="Padding" Value="4" />
|
||||
<Setter Property="FontSize" Value="{StaticResource TreeViewItemFontSize}" />
|
||||
<Setter Property="Border.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
|
||||
@@ -119,51 +121,51 @@
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:TreeListViewItem}">
|
||||
<layout:Grid VerticalAlignment="Center" RowDefinitions="Auto,*">
|
||||
<layout:Grid RowDefinitions="Auto,*" VerticalAlignment="Center">
|
||||
<Border
|
||||
x:Name="PART_OuterBorder"
|
||||
Grid.Row="0"
|
||||
MinHeight="30"
|
||||
Margin="0"
|
||||
Padding="0"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
CornerRadius="4"
|
||||
SnapsToDevicePixels="True">
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
Margin="0"
|
||||
MinHeight="30"
|
||||
Padding="0"
|
||||
SnapsToDevicePixels="True"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
x:Name="PART_OuterBorder">
|
||||
<Border
|
||||
x:Name="PART_InnerBorder"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Background="{TemplateBinding Background}"
|
||||
CornerRadius="4"
|
||||
SnapsToDevicePixels="True">
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
SnapsToDevicePixels="True"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
x:Name="PART_InnerBorder">
|
||||
<controls:GridViewRowPresenter
|
||||
x:Name="PART_Header"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Columns="{Binding Path=Columns, RelativeSource={RelativeSource AncestorType={x:Type controls:TreeListView}}}"
|
||||
Content="{TemplateBinding Header}"
|
||||
TextElement.FontSize="{TemplateBinding FontSize}" />
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
TextElement.FontSize="{TemplateBinding FontSize}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
x:Name="PART_Header" />
|
||||
</Border>
|
||||
</Border>
|
||||
<ItemsPresenter
|
||||
x:Name="ItemsHost"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
x:Name="ItemsHost" />
|
||||
</layout:Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger SourceName="PART_InnerBorder" Property="IsMouseOver" Value="true">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonForegroundPointerOver}" />
|
||||
<Setter TargetName="PART_InnerBorder" Property="Background" Value="{DynamicResource ListViewItemBackgroundPointerOver}" />
|
||||
<Trigger Property="IsMouseOver" SourceName="PART_InnerBorder" Value="true">
|
||||
<Setter Property="TextElement.Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
|
||||
<Setter Property="Background" TargetName="PART_InnerBorder" Value="{DynamicResource SubtleFillColorSecondaryBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="true">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonForeground}" />
|
||||
<Setter TargetName="PART_InnerBorder" Property="Background" Value="{DynamicResource ButtonBackgroundPointerOver}" />
|
||||
<Setter Property="TextElement.Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
|
||||
<Setter Property="Background" TargetName="PART_InnerBorder" Value="{DynamicResource ControlFillColorSecondaryBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsExpanded" Value="false">
|
||||
<Setter TargetName="ItemsHost" Property="Visibility" Value="Collapsed" />
|
||||
<Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
|
||||
@@ -173,14 +175,14 @@
|
||||
<Condition Property="HasHeader" Value="false" />
|
||||
<Condition Property="Width" Value="Auto" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="PART_Header" Property="MinWidth" Value="75" />
|
||||
<Setter Property="MinWidth" TargetName="PART_Header" Value="75" />
|
||||
</MultiTrigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="HasHeader" Value="false" />
|
||||
<Condition Property="Height" Value="Auto" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="PART_Header" Property="MinHeight" Value="19" />
|
||||
<Setter Property="MinHeight" TargetName="PART_Header" Value="19" />
|
||||
</MultiTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
@@ -190,9 +192,9 @@
|
||||
|
||||
<Style BasedOn="{StaticResource DefaultTreeListViewItemStyle}" TargetType="{x:Type controls:TreeListViewItem}" />
|
||||
|
||||
<Style x:Key="DefaultTreeListViewStyle" TargetType="{x:Type controls:TreeListView}">
|
||||
<Style TargetType="{x:Type controls:TreeListView}" x:Key="DefaultTreeListViewStyle">
|
||||
<Setter Property="FocusVisualStyle" Value="{StaticResource DefaultControlFocusVisualStyle}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TreeViewItemForeground}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Margin" Value="0" />
|
||||
<Setter Property="Padding" Value="0" />
|
||||
@@ -210,19 +212,19 @@
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:TreeListView}">
|
||||
<Border
|
||||
x:Name="Bd"
|
||||
Padding="0"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
Padding="0"
|
||||
x:Name="Bd">
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled">
|
||||
<DockPanel>
|
||||
<controls:GridViewHeaderRowPresenter
|
||||
Margin="4"
|
||||
ColumnHeaderContainerStyle="{DynamicResource UiGridViewColumnHeaderStyle}"
|
||||
Columns="{TemplateBinding Columns}"
|
||||
DockPanel.Dock="Top"
|
||||
Margin="4"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
||||
<ItemsPresenter />
|
||||
@@ -232,7 +234,7 @@
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
|
||||
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
Reference in New Issue
Block a user