This commit is contained in:
ShrlAlgo
2025-07-11 09:20:23 +08:00
parent c7b104f44f
commit 4d35cadb56
840 changed files with 102347 additions and 11595 deletions

View File

@@ -1,18 +1,11 @@
<!--
This Source Code Form is subject to the terms of the MIT License.
If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
Copyright (C) Leszek Pomianowski and WPF UI Contributors.
All Rights Reserved.
-->
<ResourceDictionary
<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:controls="clr-namespace:WPFluent.Controls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="DefaultTreeViewStyle" TargetType="{x:Type TreeView}">
<Style TargetType="{x:Type TreeView}" x:Key="DefaultTreeViewStyle">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Foreground" Value="{DynamicResource TreeViewItemForeground}" />
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Margin" Value="0" />
@@ -27,23 +20,23 @@
<Setter.Value>
<ControlTemplate TargetType="TreeView">
<Border
Name="Border"
Padding="0"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4">
CornerRadius="4"
Name="Border"
Padding="0">
<controls:PassiveScrollViewer
x:Name="ItemsPresenterScrollViewer"
CanContentScroll="False"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
x:Name="ItemsPresenterScrollViewer">
<ItemsPresenter Margin="{TemplateBinding Padding}" />
</controls:PassiveScrollViewer>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="VirtualizingPanel.IsVirtualizing" Value="True">
<Setter TargetName="ItemsPresenterScrollViewer" Property="CanContentScroll" Value="True" />
<Setter Property="CanContentScroll" TargetName="ItemsPresenterScrollViewer" Value="True" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>

View File

@@ -1,21 +1,13 @@
<!--
This Source Code Form is subject to the terms of the MIT License.
If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
Copyright (C) Leszek Pomianowski and WPF UI Contributors.
All Rights Reserved.
-->
<ResourceDictionary
<ResourceDictionary
x:Class="WPFluent.Controls.Dictionary.TreeViewItem"
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:system="clr-namespace:System;assembly=mscorlib">
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<system:Double x:Key="TreeViewItemChevronSize">10</system:Double>
<system:Double x:Key="TreeViewItemFontSize">14</system:Double>
<Style x:Key="ExpandCollapseToggleButtonStyle" TargetType="{x:Type ToggleButton}">
<Style TargetType="{x:Type ToggleButton}" x:Key="ExpandCollapseToggleButtonStyle">
<!-- Universal WPF UI focus -->
<Setter Property="FocusVisualStyle" Value="{DynamicResource DefaultControlFocusVisualStyle}" />
<!-- Universal WPF UI focus -->
@@ -26,19 +18,19 @@
<Setter.Value>
<ControlTemplate TargetType="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">
@@ -46,10 +38,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>
@@ -57,10 +49,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>
@@ -71,12 +63,12 @@
</Setter>
</Style>
<Style x:Key="DefaultTreeViewItemStyle" TargetType="{x:Type TreeViewItem}">
<Style TargetType="{x:Type TreeViewItem}" x:Key="DefaultTreeViewItemStyle">
<!-- Universal WPF UI focus -->
<Setter Property="FocusVisualStyle" Value="{DynamicResource DefaultControlFocusVisualStyle}" />
<!-- Universal WPF UI focus -->
<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}" />
@@ -92,89 +84,89 @@
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border
x:Name="Border"
CornerRadius="{TemplateBinding Border.CornerRadius}"
Grid.Row="0"
CornerRadius="{TemplateBinding Border.CornerRadius}">
x:Name="Border">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" MinWidth="19" />
<ColumnDefinition MinWidth="19" Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Rectangle
x:Name="ActiveRectangle"
Fill="{DynamicResource SystemFillColorAttentionBrush}"
Grid.Column="0"
Width="3"
Height="16"
Margin="0,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Fill="{DynamicResource TreeViewItemSelectionIndicatorForeground}"
Margin="0,0,0,0"
RadiusX="2"
RadiusY="2"
Visibility="Collapsed" />
VerticalAlignment="Center"
Visibility="Collapsed"
Width="3"
x:Name="ActiveRectangle" />
<ToggleButton
x:Name="Expander"
Grid.Column="0"
Margin="8,0"
ClickMode="Press"
Grid.Column="0"
IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
Style="{StaticResource ExpandCollapseToggleButtonStyle}" />
Margin="8,0"
Style="{StaticResource ExpandCollapseToggleButtonStyle}"
x:Name="Expander" />
<ContentPresenter
x:Name="PART_Header"
Grid.Column="1"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
ContentSource="Header"
TextElement.FontSize="{TemplateBinding FontSize}" />
Grid.Column="1"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"
TextElement.FontSize="{TemplateBinding FontSize}"
x:Name="PART_Header" />
</Grid>
</Border>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" MinWidth="19" />
<ColumnDefinition MinWidth="19" Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ItemsPresenter
x:Name="ItemsHost"
Grid.Column="1"
Grid.ColumnSpan="2"
Visibility="Collapsed" />
Visibility="Collapsed"
x:Name="ItemsHost" />
</Grid>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="HasItems" Value="False">
<Setter TargetName="Expander" Property="Visibility" Value="Hidden" />
<Setter Property="Visibility" TargetName="Expander" Value="Hidden" />
</Trigger>
<Trigger Property="IsExpanded" Value="True">
<Setter TargetName="ItemsHost" Property="Visibility" Value="Visible" />
<Setter Property="Visibility" TargetName="ItemsHost" Value="Visible" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource TreeViewItemBackgroundPointerOver}" />
<Setter Property="Background" TargetName="Border" Value="{DynamicResource SubtleFillColorSecondaryBrush}" />
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource TreeViewItemBackgroundSelected}" />
<Setter TargetName="ActiveRectangle" Property="Visibility" Value="Visible" />
<Setter Property="Background" TargetName="Border" Value="{DynamicResource SubtleFillColorSecondaryBrush}" />
<Setter Property="Visibility" TargetName="ActiveRectangle" Value="Visible" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<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>
</Setter.Value>
</Setter>
<EventSetter Event="RequestBringIntoView" Handler="OnRequestBringIntoView"/>
<EventSetter Event="RequestBringIntoView" Handler="OnRequestBringIntoView" />
<Style.Triggers>
<Trigger Property="VirtualizingPanel.IsVirtualizing" Value="True">
<Setter Property="ItemsPanel">
@@ -188,9 +180,9 @@
</Style.Triggers>
</Style>
<Style x:Key="DefaultUiTreeViewItemStyle" TargetType="{x:Type controls:TreeViewItem}">
<Setter Property="Foreground" Value="{DynamicResource TreeViewItemForeground}" />
<Setter Property="Background" Value="{DynamicResource TreeViewItemBackground}" />
<Style TargetType="{x:Type controls:TreeViewItem}" x:Key="DefaultUiTreeViewItemStyle">
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
<Setter Property="Background" Value="{DynamicResource SubtleFillColorTransparentBrush}" />
<Setter Property="Padding" Value="4" />
<Setter Property="FocusVisualStyle" Value="{StaticResource TreeViewItemFocusVisual}" />
<Setter Property="OverridesDefaultStyle" Value="True" />
@@ -209,21 +201,21 @@
<RowDefinition />
</Grid.RowDefinitions>
<ToggleButton
x:Name="Expander"
Grid.Row="0"
Grid.Column="0"
ClickMode="Press"
IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
Style="{StaticResource ExpandCollapseToggleButtonStyle}" />
<Border
x:Name="Bd"
Grid.Column="0"
Grid.Row="0"
Grid.Column="1"
Padding="{TemplateBinding Padding}"
IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
Style="{StaticResource ExpandCollapseToggleButtonStyle}"
x:Name="Expander" />
<Border
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
BorderThickness="{TemplateBinding BorderThickness}"
Grid.Column="1"
Grid.Row="0"
Padding="{TemplateBinding Padding}"
x:Name="Bd">
<Border.Background>
<SolidColorBrush Opacity="0.0" Color="{DynamicResource SystemAccentColor}" />
<SolidColorBrush Color="{DynamicResource SystemAccentColor}" Opacity="0.0" />
</Border.Background>
<Grid>
<Grid.ColumnDefinitions>
@@ -232,25 +224,25 @@
</Grid.ColumnDefinitions>
<ContentPresenter
x:Name="SymbolIcon"
Content="{TemplateBinding Icon}"
Grid.Column="0"
Margin="0,0,8,0"
Content="{TemplateBinding Icon}"
TextElement.Foreground="{TemplateBinding Foreground}" />
TextElement.Foreground="{TemplateBinding Foreground}"
x:Name="SymbolIcon" />
<ContentPresenter
x:Name="PART_Header"
ContentSource="Header"
Grid.Column="1"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
ContentSource="Header" />
x:Name="PART_Header" />
</Grid>
</Border>
<ItemsPresenter
x:Name="ItemsHost"
Grid.Row="1"
Grid.Column="1"
Grid.ColumnSpan="2"
Visibility="Collapsed" />
Grid.Row="1"
Visibility="Collapsed"
x:Name="ItemsHost" />
<VisualStateManager.VisualStateGroups>
<!--
<VisualStateGroup Name="CommonStates">
@@ -275,20 +267,20 @@
<VisualState x:Name="Selected">
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Opacity)"
Duration="0:0:.16"
From="0.0"
To="1.0"
Duration="0:0:.16" />
Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Opacity)"
To="1.0" />
</Storyboard>
</VisualState>
<VisualState x:Name="Unselected" />
<VisualState x:Name="SelectedInactive">
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Opacity)"
Duration="0:0:.16"
From="0.0"
To="1.0"
Duration="0:0:.16" />
Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Opacity)"
To="1.0" />
</Storyboard>
</VisualState>
</VisualStateGroup>
@@ -306,25 +298,25 @@
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Icon" Value="{x:Null}">
<Setter TargetName="SymbolIcon" Property="Visibility" Value="Collapsed" />
<Setter TargetName="SymbolIcon" Property="Margin" Value="0" />
<Setter Property="Visibility" TargetName="SymbolIcon" Value="Collapsed" />
<Setter Property="Margin" TargetName="SymbolIcon" Value="0" />
</Trigger>
<Trigger Property="HasItems" Value="False">
<Setter TargetName="Expander" Property="Visibility" Value="Hidden" />
<Setter Property="Visibility" TargetName="Expander" Value="Hidden" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<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>