功能更新

This commit is contained in:
GG Z
2026-02-12 21:29:00 +08:00
parent a9faf251be
commit 5f1adc5ad2
341 changed files with 4293 additions and 1874 deletions

View File

@@ -0,0 +1,444 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Calendar.xaml" />
<ResourceDictionary Source="/Melskin;component/Themes/Animations.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style TargetType="{x:Type DatePickerTextBox}" x:Key="SlotTextBoxDatePickerStyle">
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
<Setter Property="Padding" Value="3" />
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DatePickerTextBox}">
<!--<ControlTemplate.Resources>
-->
<!-- 聚焦对象 -->
<!--
<Storyboard x:Key="TextBox.FocusEffect">
<DoubleAnimation
Duration="0:0:0.2"
Storyboard.TargetName="Border"
Storyboard.TargetProperty="Intensity"
To="0.5" />
</Storyboard>
-->
<!-- 取消聚焦对象 -->
<!--
<Storyboard x:Key="TextBox.LeaveEffect">
<DoubleAnimation
Duration="0:0:0.2"
Storyboard.TargetName="Border"
Storyboard.TargetProperty="Intensity"
To="0.2" />
</Storyboard>
</ControlTemplate.Resources>-->
<Grid>
<Grid>
<decorations:SlotBorder
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Intensity="0.4"
Padding="{TemplateBinding Padding}"
x:Name="slot">
<ContentControl
Focusable="False"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
IsHitTestVisible="False"
Margin="5,0,0,0"
Opacity="0"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="PART_Watermark" />
</decorations:SlotBorder>
<ScrollViewer
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="6,0,0,0"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="PART_ContentHost" />
</Grid>
<VisualStateManager.VisualStateGroups>
<!-- 占位符显示 -->
<!-- https://learn.microsoft.com/en-us/dotnet/desktop/wpf/controls/datepicker-styles-and-templates -->
<!-- DataPicker自带有这个状态所以可以直接生效 -->
<VisualStateGroup x:Name="WatermarkStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0" />
</VisualStateGroup.Transitions>
<VisualState x:Name="Unwatermarked" />
<VisualState x:Name="Watermarked">
<Storyboard>
<DoubleAnimation
Duration="0"
Storyboard.TargetName="PART_Watermark"
Storyboard.TargetProperty="Opacity"
To="1" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="false" />
<Condition Property="IsKeyboardFocused" Value="false" />
</MultiTrigger.Conditions>
<MultiTrigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource TextBox.LeaveEffect}" />
</MultiTrigger.EnterActions>
<MultiTrigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource TextBox.FocusEffect}" />
</MultiTrigger.ExitActions>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type DatePickerTextBox}" x:Key="DefaultTextBoxDatePickerStyle">
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="Background" Value="{DynamicResource BackgroundFloatingBrush}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DatePickerTextBox}">
<Grid>
<Grid>
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding assists:ControlAssist.CornerRadius}"
Padding="{TemplateBinding Padding}"
x:Name="Border">
<ContentControl
Focusable="False"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
IsHitTestVisible="False"
Margin="5,0,0,0"
Opacity="0"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="PART_Watermark" />
</Border>
<ScrollViewer
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="4,0,0,0"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="PART_ContentHost" />
</Grid>
<VisualStateManager.VisualStateGroups>
<!-- 占位符显示 -->
<!-- https://learn.microsoft.com/en-us/dotnet/desktop/wpf/controls/datepicker-styles-and-templates -->
<!-- DataPicker自带有这个状态所以可以直接生效 -->
<VisualStateGroup x:Name="WatermarkStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0" />
</VisualStateGroup.Transitions>
<VisualState x:Name="Unwatermarked" />
<VisualState x:Name="Watermarked">
<Storyboard>
<DoubleAnimation
Duration="0"
Storyboard.TargetName="PART_Watermark"
Storyboard.TargetProperty="Opacity"
To="1" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="BorderBrush" TargetName="Border" Value="{DynamicResource PrimaryNormalBrush}" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" TargetName="Border" Value="{DynamicResource ControlBackgroundHoverBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--<Style BasedOn="{StaticResource DefaultTextBoxDatePickerStyle}" TargetType="{x:Type DatePickerTextBox}" />-->
<ControlTemplate TargetType="{x:Type DatePicker}" x:Key="SlotTemplate">
<ControlTemplate.Resources>
<Style TargetType="{x:Type Button}" x:Key="CalendarPickerButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid x:Name="IconBox">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<Border
Background="{DynamicResource PrimaryGradientBrush}"
CornerRadius="3,3,0,0"
Grid.Row="0" />
<Border
Background="{DynamicResource BackgroundFloatingBrush}"
CornerRadius="0,0,3,3"
Grid.Row="1" />
<TextBlock
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" />
<Grid.Effect>
<DropShadowEffect
BlurRadius="4"
Color="{DynamicResource DarkShadowColor}"
Opacity="0.6"
ShadowDepth="1" />
</Grid.Effect>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Effect">
<Setter.Value>
<effects:BrightnessContrastEffect Brightness="0.08" />
</Setter.Value>
</Setter>
<Setter Property="Effect" TargetName="IconBox">
<Setter.Value>
<DropShadowEffect
BlurRadius="4"
Color="{DynamicResource DarkShadowColor}"
Opacity="0.4"
ShadowDepth="1" />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Effect">
<Setter.Value>
<effects:BrightnessContrastEffect Brightness="0.06" />
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ControlTemplate.Resources>
<Grid
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"
SnapsToDevicePixels="True"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="PART_Root">
<DatePickerTextBox
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" />
<Border
Background="Transparent"
HorizontalAlignment="Right"
Width="40" />
<Button
HorizontalAlignment="Right"
Margin="5"
Style="{StaticResource CalendarPickerButton}"
Width="28"
x:Name="PART_Button" />
<!-- Disabled Mask -->
<Border
Background="{DynamicResource ControlBackgroundDisabledBrush}"
CornerRadius="4"
IsHitTestVisible="False"
Margin="4"
Opacity="0"
x:Name="DisabledMask" />
<Popup
AllowsTransparency="True"
Placement="Bottom"
PlacementTarget="{Binding ElementName=PART_Button}"
StaysOpen="True"
assists:BehaviorAssist.SimulateNativeBehavior="True"
x:Name="PART_Popup" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" TargetName="DisabledMask" 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}}" />
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate TargetType="{x:Type DatePicker}" x:Key="DefaultTemplate">
<ControlTemplate.Resources>
<Style TargetType="{x:Type Button}" x:Key="CalendarPickerButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid x:Name="IconBox">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<Border
Background="{DynamicResource PrimaryGradientBrush}"
CornerRadius="3,3,0,0"
Grid.Row="0" />
<Border
Background="{DynamicResource BackgroundFloatingBrush}"
CornerRadius="0,0,3,3"
Grid.Row="1" />
<TextBlock
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" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Effect">
<Setter.Value>
<effects:BrightnessContrastEffect Brightness="0.08" />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Effect">
<Setter.Value>
<effects:BrightnessContrastEffect Brightness="0.06" />
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ControlTemplate.Resources>
<Grid
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
SnapsToDevicePixels="True"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="PART_Root">
<DatePickerTextBox
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" />
<Border
Background="Transparent"
HorizontalAlignment="Right"
Width="40" />
<Button
HorizontalAlignment="Right"
Margin="5"
Style="{StaticResource CalendarPickerButton}"
Width="28"
x:Name="PART_Button" />
<!-- Disabled Mask -->
<Border
Background="{DynamicResource ControlBackgroundDisabledBrush}"
CornerRadius="4"
IsHitTestVisible="False"
Opacity="0"
x:Name="DisabledMask" />
<Popup
AllowsTransparency="True"
Placement="Bottom"
PlacementTarget="{Binding ElementName=PART_Button}"
StaysOpen="True"
assists:BehaviorAssist.SimulateNativeBehavior="True"
x:Name="PART_Popup" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" TargetName="DisabledMask" 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}}" />
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<!-- 日期图标按钮 -->
<Style TargetType="{x:Type DatePicker}" x:Key="SlotDatePicker">
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="IsTodayHighlighted" Value="True" />
<Setter Property="SelectedDateFormat" Value="Short" />
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
<Setter Property="Padding" Value="0" />
<!--<Setter Property="Margin" Value="0"/>-->
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="CalendarStyle" Value="{StaticResource DefaultCalendarPickerStyle}" />
<Setter Property="MinWidth" Value="150" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="Template" Value="{StaticResource SlotTemplate}" />
</Style>
<Style TargetType="{x:Type DatePicker}">
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="IsTodayHighlighted" Value="True" />
<Setter Property="SelectedDateFormat" Value="Short" />
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
<Setter Property="CalendarStyle" Value="{StaticResource DefaultCalendarPickerStyle}" />
<Setter Property="MinWidth" Value="150" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="Template" Value="{StaticResource DefaultTemplate}" />
</Style>
</ResourceDictionary>