整理代码

This commit is contained in:
GG Z
2026-02-20 15:31:44 +08:00
parent 94cf3f3266
commit 9f121cfc7f
149 changed files with 4063 additions and 6964 deletions

View File

@@ -1,15 +1,15 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:assists="clr-namespace:Melskin.Assists"
xmlns:decorations="clr-namespace:Melskin.Controls.Decorations"
xmlns:effects="clr-namespace:Melskin.Effects"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
xmlns:effects="clr-namespace:Melskin.Effects">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Calendar.xaml" />
<ResourceDictionary Source="/Melskin;component/Themes/Animations.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style TargetType="{x:Type DatePickerTextBox}" x:Key="SlotTextBoxDatePickerStyle">
<Style x:Key="SlotTextBoxDatePickerStyle" TargetType="{x:Type DatePickerTextBox}">
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
<Setter Property="Padding" Value="3" />
@@ -44,28 +44,28 @@
<Grid>
<Grid>
<decorations:SlotBorder
x:Name="slot"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Intensity="0.4"
Padding="{TemplateBinding Padding}"
x:Name="slot">
Intensity="0.4">
<ContentControl
Focusable="False"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
IsHitTestVisible="False"
x:Name="PART_Watermark"
Margin="5,0,0,0"
Opacity="0"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="PART_Watermark" />
Focusable="False"
IsHitTestVisible="False"
Opacity="0" />
</decorations:SlotBorder>
<ScrollViewer
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
x:Name="PART_ContentHost"
Margin="6,0,0,0"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="PART_ContentHost" />
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
</Grid>
<VisualStateManager.VisualStateGroups>
<!-- 占位符显示 -->
@@ -79,10 +79,10 @@
<VisualState x:Name="Watermarked">
<Storyboard>
<DoubleAnimation
Duration="0"
Storyboard.TargetName="PART_Watermark"
Storyboard.TargetProperty="Opacity"
To="1" />
To="1"
Duration="0" />
</Storyboard>
</VisualState>
</VisualStateGroup>
@@ -107,7 +107,7 @@
</Setter>
</Style>
<Style TargetType="{x:Type DatePickerTextBox}" x:Key="DefaultTextBoxDatePickerStyle">
<Style x:Key="DefaultTextBoxDatePickerStyle" TargetType="{x:Type DatePickerTextBox}">
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="Background" Value="{DynamicResource BackgroundFloatingBrush}" />
<Setter Property="VerticalAlignment" Value="Center" />
@@ -121,26 +121,26 @@
<Grid>
<Grid>
<Border
x:Name="Border"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding assists:ControlAssist.CornerRadius}"
Padding="{TemplateBinding Padding}"
x:Name="Border">
CornerRadius="{TemplateBinding assists:ControlAssist.CornerRadius}">
<ContentControl
Focusable="False"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
IsHitTestVisible="False"
x:Name="PART_Watermark"
Margin="5,0,0,0"
Opacity="0"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="PART_Watermark" />
Focusable="False"
IsHitTestVisible="False"
Opacity="0" />
</Border>
<ScrollViewer
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
x:Name="PART_ContentHost"
Margin="4,0,0,0"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="PART_ContentHost" />
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
</Grid>
<VisualStateManager.VisualStateGroups>
<!-- 占位符显示 -->
@@ -154,10 +154,10 @@
<VisualState x:Name="Watermarked">
<Storyboard>
<DoubleAnimation
Duration="0"
Storyboard.TargetName="PART_Watermark"
Storyboard.TargetProperty="Opacity"
To="1" />
To="1"
Duration="0" />
</Storyboard>
</VisualState>
</VisualStateGroup>
@@ -165,10 +165,10 @@
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="BorderBrush" TargetName="Border" Value="{DynamicResource PrimaryNormalBrush}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource PrimaryNormalBrush}" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="Border" Value="{DynamicResource ControlBackgroundHoverBrush}" />
<Setter TargetName="Border" Property="Background" Value="{DynamicResource ControlBackgroundHoverBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
@@ -178,9 +178,9 @@
<!--<Style BasedOn="{StaticResource DefaultTextBoxDatePickerStyle}" TargetType="{x:Type DatePickerTextBox}" />-->
<ControlTemplate TargetType="{x:Type DatePicker}" x:Key="SlotTemplate">
<ControlTemplate x:Key="SlotTemplate" TargetType="{x:Type DatePicker}">
<ControlTemplate.Resources>
<Style TargetType="{x:Type Button}" x:Key="CalendarPickerButton">
<Style x:Key="CalendarPickerButton" TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
@@ -190,33 +190,33 @@
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<Border
Grid.Row="0"
Background="{DynamicResource PrimaryGradientBrush}"
CornerRadius="3,3,0,0"
Grid.Row="0" />
CornerRadius="3,3,0,0" />
<Border
Grid.Row="1"
Background="{DynamicResource BackgroundFloatingBrush}"
CornerRadius="0,0,3,3"
Grid.Row="1" />
CornerRadius="0,0,3,3" />
<TextBlock
Grid.Row="0"
HorizontalAlignment="Center"
FontSize="8"
FontWeight="ExtraBold"
Foreground="{DynamicResource BackgroundFloatingBrush}"
Grid.Row="0"
HorizontalAlignment="Center"
Text="TEN" />
<TextBlock
FontWeight="ExtraBold"
Foreground="{DynamicResource TextSecondaryBrush}"
Grid.Row="1"
HorizontalAlignment="Center"
Text="18"
VerticalAlignment="Stretch" />
VerticalAlignment="Stretch"
FontWeight="ExtraBold"
Foreground="{DynamicResource TextSecondaryBrush}"
Text="18" />
<Grid.Effect>
<DropShadowEffect
BlurRadius="4"
Color="{DynamicResource DarkShadowColor}"
Opacity="0.6"
ShadowDepth="1" />
ShadowDepth="1"
Color="{DynamicResource DarkShadowColor}" />
</Grid.Effect>
</Grid>
<ControlTemplate.Triggers>
@@ -226,13 +226,13 @@
<effects:BrightnessContrastEffect Brightness="0.08" />
</Setter.Value>
</Setter>
<Setter Property="Effect" TargetName="IconBox">
<Setter TargetName="IconBox" Property="Effect">
<Setter.Value>
<DropShadowEffect
BlurRadius="4"
Color="{DynamicResource DarkShadowColor}"
Opacity="0.4"
ShadowDepth="1" />
ShadowDepth="1"
Color="{DynamicResource DarkShadowColor}" />
</Setter.Value>
</Setter>
</Trigger>
@@ -251,62 +251,62 @@
</ControlTemplate.Resources>
<Grid
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
x:Name="PART_Root"
Margin="{TemplateBinding Padding}"
SnapsToDevicePixels="True"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="PART_Root">
SnapsToDevicePixels="True">
<DatePickerTextBox
x:Name="PART_TextBox"
Grid.Row="0"
Grid.Column="0"
HorizontalContentAlignment="Left"
VerticalContentAlignment="Center"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Focusable="{TemplateBinding Focusable}"
Grid.Column="0"
Grid.Row="0"
HorizontalContentAlignment="Left"
Style="{StaticResource SlotTextBoxDatePickerStyle}"
VerticalContentAlignment="Center"
x:Name="PART_TextBox" />
Style="{StaticResource SlotTextBoxDatePickerStyle}" />
<Border
Background="Transparent"
Width="40"
HorizontalAlignment="Right"
Width="40" />
Background="Transparent" />
<Button
HorizontalAlignment="Right"
Margin="5"
Style="{StaticResource CalendarPickerButton}"
x:Name="PART_Button"
Width="28"
x:Name="PART_Button" />
Margin="5"
HorizontalAlignment="Right"
Style="{StaticResource CalendarPickerButton}" />
<!-- Disabled Mask -->
<Border
x:Name="DisabledMask"
Margin="4"
Background="{DynamicResource ControlBackgroundDisabledBrush}"
CornerRadius="4"
IsHitTestVisible="False"
Margin="4"
Opacity="0"
x:Name="DisabledMask" />
Opacity="0" />
<Popup
x:Name="PART_Popup"
assists:BehaviorAssist.SimulateNativeBehavior="True"
AllowsTransparency="True"
Placement="Bottom"
PlacementTarget="{Binding ElementName=PART_Button}"
StaysOpen="True"
assists:BehaviorAssist.SimulateNativeBehavior="True"
x:Name="PART_Popup" />
StaysOpen="True" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" TargetName="DisabledMask" Value="0.6" />
<Setter TargetName="DisabledMask" Property="Opacity" Value="0.6" />
</Trigger>
<DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="false">
<Setter Property="Foreground" TargetName="PART_TextBox" Value="{Binding Foreground, RelativeSource={RelativeSource TemplatedParent}}" />
<Setter TargetName="PART_TextBox" Property="Foreground" Value="{Binding Foreground, RelativeSource={RelativeSource TemplatedParent}}" />
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate TargetType="{x:Type DatePicker}" x:Key="DefaultTemplate">
<ControlTemplate x:Key="DefaultTemplate" TargetType="{x:Type DatePicker}">
<ControlTemplate.Resources>
<Style TargetType="{x:Type Button}" x:Key="CalendarPickerButton">
<Style x:Key="CalendarPickerButton" TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
@@ -316,27 +316,27 @@
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<Border
Grid.Row="0"
Background="{DynamicResource PrimaryGradientBrush}"
CornerRadius="3,3,0,0"
Grid.Row="0" />
CornerRadius="3,3,0,0" />
<Border
Grid.Row="1"
Background="{DynamicResource BackgroundFloatingBrush}"
CornerRadius="0,0,3,3"
Grid.Row="1" />
CornerRadius="0,0,3,3" />
<TextBlock
Grid.Row="0"
HorizontalAlignment="Center"
FontSize="8"
FontWeight="ExtraBold"
Foreground="{DynamicResource BackgroundFloatingBrush}"
Grid.Row="0"
HorizontalAlignment="Center"
Text="TEN" />
<TextBlock
FontWeight="ExtraBold"
Foreground="{DynamicResource TextSecondaryBrush}"
Grid.Row="1"
HorizontalAlignment="Center"
Text="18"
VerticalAlignment="Stretch" />
VerticalAlignment="Stretch"
FontWeight="ExtraBold"
Foreground="{DynamicResource TextSecondaryBrush}"
Text="18" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
@@ -361,59 +361,59 @@
</Style>
</ControlTemplate.Resources>
<Grid
x:Name="PART_Root"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
SnapsToDevicePixels="True"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="PART_Root">
SnapsToDevicePixels="True">
<DatePickerTextBox
x:Name="PART_TextBox"
Grid.Row="0"
Grid.Column="0"
VerticalAlignment="Stretch"
HorizontalContentAlignment="Left"
VerticalContentAlignment="Center"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Focusable="{TemplateBinding Focusable}"
Grid.Column="0"
Grid.Row="0"
HorizontalContentAlignment="Left"
Style="{StaticResource DefaultTextBoxDatePickerStyle}"
VerticalAlignment="Stretch"
VerticalContentAlignment="Center"
x:Name="PART_TextBox" />
Style="{StaticResource DefaultTextBoxDatePickerStyle}" />
<Border
Background="Transparent"
Width="40"
HorizontalAlignment="Right"
Width="40" />
Background="Transparent" />
<Button
HorizontalAlignment="Right"
Margin="5"
Style="{StaticResource CalendarPickerButton}"
x:Name="PART_Button"
Width="28"
x:Name="PART_Button" />
Margin="5"
HorizontalAlignment="Right"
Style="{StaticResource CalendarPickerButton}" />
<!-- Disabled Mask -->
<Border
x:Name="DisabledMask"
Background="{DynamicResource ControlBackgroundDisabledBrush}"
CornerRadius="4"
IsHitTestVisible="False"
Opacity="0"
x:Name="DisabledMask" />
Opacity="0" />
<Popup
x:Name="PART_Popup"
assists:BehaviorAssist.SimulateNativeBehavior="True"
AllowsTransparency="True"
Placement="Bottom"
PlacementTarget="{Binding ElementName=PART_Button}"
StaysOpen="True"
assists:BehaviorAssist.SimulateNativeBehavior="True"
x:Name="PART_Popup" />
StaysOpen="True" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" TargetName="DisabledMask" Value="0.6" />
<Setter TargetName="DisabledMask" Property="Opacity" Value="0.6" />
</Trigger>
<DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="false">
<Setter Property="Foreground" TargetName="PART_TextBox" Value="{Binding Foreground, RelativeSource={RelativeSource TemplatedParent}}" />
<Setter TargetName="PART_TextBox" Property="Foreground" Value="{Binding Foreground, RelativeSource={RelativeSource TemplatedParent}}" />
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<!-- 日期图标按钮 -->
<Style TargetType="{x:Type DatePicker}" x:Key="SlotDatePicker">
<Style x:Key="SlotDatePicker" TargetType="{x:Type DatePicker}">
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="IsTodayHighlighted" Value="True" />
<Setter Property="SelectedDateFormat" Value="Short" />