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,8 @@
<!--
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.
Based on Microsoft XAML for Win UI
Copyright (c) Microsoft Corporation. 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:system="clr-namespace:System;assembly=mscorlib">
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/WPFluent;component/Resources/Variables.xaml" />
</ResourceDictionary.MergedDictionaries>
@@ -24,18 +14,18 @@
<Thickness x:Key="NumberBoxButtonPadding">0,0,0,0</Thickness>
<system:Double x:Key="NumberBoxButtonHeight">24</system:Double>
<system:Double x:Key="NumberBoxButtonIconSize">14</system:Double>
<Style x:Key="DefaultUiNumberBoxStyle" TargetType="{x:Type controls:NumberBox}">
<Style TargetType="{x:Type controls:NumberBox}" x:Key="DefaultUiNumberBoxStyle">
<!-- Universal WPF UI focus -->
<Setter Property="FocusVisualStyle" Value="{DynamicResource DefaultControlFocusVisualStyle}" />
<!-- Universal WPF UI focus -->
<!-- Universal WPF UI ContextMenu -->
<Setter Property="ContextMenu" Value="{DynamicResource DefaultControlContextMenu}" />
<!-- Universal WPF UI ContextMenu -->
<Setter Property="Foreground" Value="{DynamicResource TextControlForeground}" />
<Setter Property="CaretBrush" Value="{DynamicResource TextControlForeground}" />
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
<Setter Property="CaretBrush" Value="{DynamicResource TextFillColorPrimaryBrush}" />
<Setter Property="Cursor" Value="Arrow" />
<Setter Property="Background" Value="{DynamicResource TextControlBackground}" />
<Setter Property="Background" Value="{DynamicResource ControlFillColorDefaultBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource TextControlElevationBorderBrush}" />
<Setter Property="BorderThickness" Value="{StaticResource NumberBoxBorderThemeThickness}" />
<Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}" />
@@ -56,18 +46,18 @@
<ControlTemplate TargetType="{x:Type controls:NumberBox}">
<Grid HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
<Border
x:Name="ContentBorder"
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
MinWidth="{TemplateBinding MinWidth}"
MinHeight="{TemplateBinding MinHeight}"
Padding="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding Border.CornerRadius}">
CornerRadius="{TemplateBinding Border.CornerRadius}"
Height="{TemplateBinding Height}"
HorizontalAlignment="Stretch"
MinHeight="{TemplateBinding MinHeight}"
MinWidth="{TemplateBinding MinWidth}"
Padding="0"
VerticalAlignment="Stretch"
Width="{TemplateBinding Width}"
x:Name="ContentBorder">
<Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
@@ -75,152 +65,152 @@
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Background="Transparent">
<Grid Background="Transparent" Grid.Column="0">
<ContentControl
x:Name="ControlIconLeft"
Margin="{StaticResource NumberBoxLeftIconMargin}"
Padding="0"
VerticalAlignment="Top"
Content="{TemplateBinding Icon}"
FontSize="16"
Foreground="{TemplateBinding Foreground}"
IsTabStop="False" />
IsTabStop="False"
Margin="{StaticResource NumberBoxLeftIconMargin}"
Padding="0"
VerticalAlignment="Top"
x:Name="ControlIconLeft" />
</Grid>
<Grid
x:Name="TextContentArea"
Background="Transparent"
Grid.Column="1"
Background="Transparent">
x:Name="TextContentArea">
<Grid Margin="{TemplateBinding Padding}">
<controls:PassiveScrollViewer
x:Name="PART_ContentHost"
Style="{DynamicResource DefaultTextBoxScrollViewerStyle}"
TextElement.Foreground="{TemplateBinding Foreground}" />
TextElement.Foreground="{TemplateBinding Foreground}"
x:Name="PART_ContentHost" />
<TextBlock
x:Name="PlaceholderTextBox"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Margin="0"
Padding="1,0"
Text="{TemplateBinding PlaceholderText}"
VerticalAlignment="Top"
Foreground="{DynamicResource TextControlPlaceholderForeground}"
Text="{TemplateBinding PlaceholderText}" />
x:Name="PlaceholderTextBox" />
</Grid>
</Grid>
<!-- Buttons and Icons have no padding from the main element to allow absolute positions if height is larger than the text entry zone -->
<StackPanel
Grid.Column="2"
Background="Transparent"
Grid.Column="2"
Orientation="Horizontal">
<Button
x:Name="PART_ClearButton"
Width="{StaticResource NumberBoxButtonHeight}"
Height="{StaticResource NumberBoxButtonHeight}"
Margin="{StaticResource NumberBoxButtonMargin}"
Padding="{StaticResource NumberBoxButtonPadding}"
HorizontalAlignment="Center"
VerticalAlignment="Top"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Background="Transparent"
BorderBrush="Transparent"
Focusable="False"
Foreground="{DynamicResource TextControlButtonForeground}"
IsTabStop="False">
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Height="{StaticResource NumberBoxButtonHeight}"
HorizontalAlignment="Center"
HorizontalContentAlignment="Center"
IsTabStop="False"
Margin="{StaticResource NumberBoxButtonMargin}"
Padding="{StaticResource NumberBoxButtonPadding}"
VerticalAlignment="Top"
VerticalContentAlignment="Center"
Width="{StaticResource NumberBoxButtonHeight}"
x:Name="PART_ClearButton">
<controls:SymbolIcon FontSize="{StaticResource NumberBoxButtonIconSize}" Symbol="Dismiss24" />
</Button>
<RepeatButton
x:Name="PART_InlineIncrementButton"
Width="{StaticResource NumberBoxButtonHeight}"
Height="{StaticResource NumberBoxButtonHeight}"
Margin="{StaticResource NumberBoxButtonMargin}"
Padding="{StaticResource NumberBoxButtonPadding}"
HorizontalAlignment="Center"
VerticalAlignment="Top"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Background="Transparent"
BorderBrush="Transparent"
Foreground="{DynamicResource TextControlButtonForeground}"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Height="{StaticResource NumberBoxButtonHeight}"
HorizontalAlignment="Center"
HorizontalContentAlignment="Center"
IsTabStop="False"
Visibility="Collapsed">
Margin="{StaticResource NumberBoxButtonMargin}"
Padding="{StaticResource NumberBoxButtonPadding}"
VerticalAlignment="Top"
VerticalContentAlignment="Center"
Visibility="Collapsed"
Width="{StaticResource NumberBoxButtonHeight}"
x:Name="PART_InlineIncrementButton">
<controls:SymbolIcon FontSize="{StaticResource NumberBoxButtonIconSize}" Symbol="ChevronUp24" />
</RepeatButton>
<RepeatButton
x:Name="PART_InlineDecrementButton"
Width="{StaticResource NumberBoxButtonHeight}"
Height="{StaticResource NumberBoxButtonHeight}"
Margin="{StaticResource NumberBoxButtonMargin}"
Padding="{StaticResource NumberBoxButtonPadding}"
HorizontalAlignment="Center"
VerticalAlignment="Top"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Background="Transparent"
BorderBrush="Transparent"
FontSize="{StaticResource NumberBoxButtonIconSize}"
Foreground="{DynamicResource TextControlButtonForeground}"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Height="{StaticResource NumberBoxButtonHeight}"
HorizontalAlignment="Center"
HorizontalContentAlignment="Center"
IsTabStop="False"
Visibility="Collapsed">
Margin="{StaticResource NumberBoxButtonMargin}"
Padding="{StaticResource NumberBoxButtonPadding}"
VerticalAlignment="Top"
VerticalContentAlignment="Center"
Visibility="Collapsed"
Width="{StaticResource NumberBoxButtonHeight}"
x:Name="PART_InlineDecrementButton">
<controls:SymbolIcon FontSize="{StaticResource NumberBoxButtonIconSize}" Symbol="ChevronDown24" />
</RepeatButton>
</StackPanel>
<ContentControl
x:Name="ControlIconRight"
Grid.Column="3"
Margin="{StaticResource NumberBoxRightIconMargin}"
Padding="0"
VerticalAlignment="Top"
Content="{TemplateBinding Icon}"
FontSize="16"
Foreground="{TemplateBinding Foreground}"
IsTabStop="False" />
Grid.Column="3"
IsTabStop="False"
Margin="{StaticResource NumberBoxRightIconMargin}"
Padding="0"
VerticalAlignment="Top"
x:Name="ControlIconRight" />
</Grid>
</Border>
<!-- The Accent Border is a separate element so that changes to the border thickness do not affect the position of the element -->
<Border
x:Name="AccentBorder"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}"
BorderThickness="{StaticResource NumberBoxAccentBorderThemeThickness}"
CornerRadius="{TemplateBinding Border.CornerRadius}" />
CornerRadius="{TemplateBinding Border.CornerRadius}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
x:Name="AccentBorder" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="CurrentPlaceholderEnabled" Value="False">
<Setter TargetName="PlaceholderTextBox" Property="Visibility" Value="Collapsed" />
<Setter Property="Visibility" TargetName="PlaceholderTextBox" Value="Collapsed" />
</Trigger>
<Trigger Property="ShowClearButton" Value="False">
<Setter TargetName="PART_ClearButton" Property="Visibility" Value="Collapsed" />
<Setter TargetName="PART_ClearButton" Property="Margin" Value="0" />
<Setter Property="Visibility" TargetName="PART_ClearButton" Value="Collapsed" />
<Setter Property="Margin" TargetName="PART_ClearButton" Value="0" />
</Trigger>
<Trigger Property="ClearButtonEnabled" Value="False">
<Setter TargetName="PART_ClearButton" Property="Visibility" Value="Collapsed" />
<Setter TargetName="PART_ClearButton" Property="Margin" Value="0" />
<Setter Property="Visibility" TargetName="PART_ClearButton" Value="Collapsed" />
<Setter Property="Margin" TargetName="PART_ClearButton" Value="0" />
</Trigger>
<Trigger Property="SpinButtonPlacementMode" Value="Hidden">
<Setter TargetName="PART_InlineIncrementButton" Property="Margin" Value="0" />
<Setter TargetName="PART_InlineDecrementButton" Property="Margin" Value="0" />
<Setter Property="Margin" TargetName="PART_InlineIncrementButton" Value="0" />
<Setter Property="Margin" TargetName="PART_InlineDecrementButton" Value="0" />
</Trigger>
<Trigger Property="SpinButtonPlacementMode" Value="Inline">
<Setter TargetName="PART_InlineIncrementButton" Property="Visibility" Value="Visible" />
<Setter TargetName="PART_InlineDecrementButton" Property="Visibility" Value="Visible" />
<Setter Property="Visibility" TargetName="PART_InlineIncrementButton" Value="Visible" />
<Setter Property="Visibility" TargetName="PART_InlineDecrementButton" Value="Visible" />
</Trigger>
<Trigger Property="IconPlacement" Value="Left">
<Setter TargetName="ControlIconRight" Property="Visibility" Value="Collapsed" />
<Setter TargetName="ControlIconRight" Property="Margin" Value="0" />
<Setter Property="Visibility" TargetName="ControlIconRight" Value="Collapsed" />
<Setter Property="Margin" TargetName="ControlIconRight" Value="0" />
</Trigger>
<Trigger Property="IconPlacement" Value="Right">
<Setter TargetName="ControlIconLeft" Property="Visibility" Value="Collapsed" />
<Setter TargetName="ControlIconLeft" Property="Margin" Value="0" />
<Setter Property="Visibility" TargetName="ControlIconLeft" Value="Collapsed" />
<Setter Property="Margin" TargetName="ControlIconLeft" Value="0" />
</Trigger>
<Trigger Property="Icon" Value="{x:Null}">
<Setter TargetName="ControlIconRight" Property="Visibility" Value="Collapsed" />
<Setter TargetName="ControlIconRight" Property="Margin" Value="0" />
<Setter TargetName="ControlIconLeft" Property="Visibility" Value="Collapsed" />
<Setter TargetName="ControlIconLeft" Property="Margin" Value="0" />
<Setter Property="Visibility" TargetName="ControlIconRight" Value="Collapsed" />
<Setter Property="Margin" TargetName="ControlIconRight" Value="0" />
<Setter Property="Visibility" TargetName="ControlIconLeft" Value="Collapsed" />
<Setter Property="Margin" TargetName="ControlIconLeft" Value="0" />
</Trigger>
<Trigger Property="IsFocused" Value="True">
<Setter TargetName="AccentBorder" Property="BorderThickness" Value="0,0,0,2" />
<Setter TargetName="AccentBorder" Property="BorderBrush" Value="{DynamicResource TextControlFocusedBorderBrush}" />
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource TextControlBackgroundFocused}" />
<Setter Property="BorderThickness" TargetName="AccentBorder" Value="0,0,0,2" />
<Setter Property="BorderBrush" TargetName="AccentBorder" Value="{DynamicResource SystemFillColorAttentionBrush}" />
<Setter Property="Background" TargetName="ContentBorder" Value="{DynamicResource ControlFillColorInputActiveBrush}" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
@@ -228,25 +218,25 @@
<Condition Property="IsMouseOver" Value="True" />
<Condition Property="IsFocused" Value="False" />
</MultiTrigger.Conditions>
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource TextControlBackgroundPointerOver}" />
<Setter Property="Background" TargetName="ContentBorder" Value="{DynamicResource ControlFillColorSecondaryBrush}" />
</MultiTrigger>
<Trigger Property="IsReadOnly" Value="True">
<Setter Property="SpinButtonPlacementMode" Value="Hidden" />
<Setter TargetName="PART_ClearButton" Property="Visibility" Value="Collapsed" />
<Setter TargetName="PART_ClearButton" Property="Margin" Value="0" />
<Setter Property="Visibility" TargetName="PART_ClearButton" Value="Collapsed" />
<Setter Property="Margin" TargetName="PART_ClearButton" Value="0" />
</Trigger>
<Trigger Property="IsEnabled" Value="True">
<Setter TargetName="TextContentArea" Property="Cursor" Value="IBeam" />
<Setter Property="Cursor" TargetName="TextContentArea" Value="IBeam" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="TextContentArea" Property="Cursor" Value="Arrow" />
<Setter TargetName="ContentBorder" Property="Background" Value="{DynamicResource TextControlBackgroundDisabled}" />
<Setter TargetName="ContentBorder" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushDisabled}" />
<Setter TargetName="AccentBorder" Property="BorderBrush" Value="{DynamicResource TextControlBorderBrushDisabled}" />
<Setter TargetName="ControlIconLeft" Property="Foreground" Value="{DynamicResource TextControlForegroundDisabled}" />
<Setter TargetName="ControlIconRight" Property="Foreground" Value="{DynamicResource TextControlForegroundDisabled}" />
<Setter TargetName="PlaceholderTextBox" Property="Foreground" Value="{DynamicResource TextControlForegroundDisabled}" />
<Setter Property="Foreground" Value="{DynamicResource TextControlForegroundDisabled}" />
<Setter Property="Cursor" TargetName="TextContentArea" Value="Arrow" />
<Setter Property="Background" TargetName="ContentBorder" Value="{DynamicResource ControlFillColorDisabledBrush}" />
<Setter Property="BorderBrush" TargetName="ContentBorder" Value="{DynamicResource ControlStrokeColorDefaultBrush}" />
<Setter Property="BorderBrush" TargetName="AccentBorder" Value="{DynamicResource ControlStrokeColorDefaultBrush}" />
<Setter Property="Foreground" TargetName="ControlIconLeft" Value="{DynamicResource TextFillColorDisabledBrush}" />
<Setter Property="Foreground" TargetName="ControlIconRight" Value="{DynamicResource TextFillColorDisabledBrush}" />
<Setter Property="Foreground" TargetName="PlaceholderTextBox" Value="{DynamicResource TextFillColorDisabledBrush}" />
<Setter Property="Foreground" Value="{DynamicResource TextFillColorDisabledBrush}" />
<Setter Property="ClearButtonEnabled" Value="False" />
<Setter Property="SpinButtonPlacementMode" Value="Hidden" />
</Trigger>