2025-08-20 12:10:13 +08:00
|
|
|
<ResourceDictionary
|
|
|
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
2026-02-20 15:31:44 +08:00
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
2026-01-02 17:30:41 +08:00
|
|
|
xmlns:assists="clr-namespace:Melskin.Assists"
|
2026-02-20 15:31:44 +08:00
|
|
|
xmlns:controls="clr-namespace:Melskin.Controls">
|
2025-09-08 19:49:09 +08:00
|
|
|
<ResourceDictionary.MergedDictionaries>
|
2026-01-02 17:30:41 +08:00
|
|
|
<ResourceDictionary Source="/Melskin;component/Controls/FlattenButton.xaml" />
|
2025-09-08 19:49:09 +08:00
|
|
|
</ResourceDictionary.MergedDictionaries>
|
2026-02-20 15:31:44 +08:00
|
|
|
<Style x:Key="TimePickerFlyoutListBoxItemStyle" TargetType="ListBoxItem">
|
2025-08-20 12:10:13 +08:00
|
|
|
<Setter Property="Padding" Value="5,8" />
|
|
|
|
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
|
|
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|
|
|
|
<Setter Property="Background" Value="Transparent" />
|
|
|
|
|
<Setter Property="BorderThickness" Value="0" />
|
|
|
|
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
|
|
|
|
<Setter Property="Template">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<ControlTemplate TargetType="ListBoxItem">
|
|
|
|
|
<Border
|
2026-02-20 15:31:44 +08:00
|
|
|
x:Name="Bd"
|
|
|
|
|
Padding="{TemplateBinding Padding}"
|
2025-08-20 12:10:13 +08:00
|
|
|
Background="{TemplateBinding Background}"
|
|
|
|
|
CornerRadius="4"
|
2026-02-20 15:31:44 +08:00
|
|
|
SnapsToDevicePixels="true">
|
2025-08-20 12:10:13 +08:00
|
|
|
<ContentPresenter
|
|
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
2026-02-20 15:31:44 +08:00
|
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
|
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
2025-08-20 12:10:13 +08:00
|
|
|
</Border>
|
|
|
|
|
<ControlTemplate.Triggers>
|
|
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
2026-02-20 15:31:44 +08:00
|
|
|
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource ControlBackgroundHoverBrush}" />
|
2025-08-20 12:10:13 +08:00
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="IsSelected" Value="True">
|
2026-02-20 15:31:44 +08:00
|
|
|
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource PrimaryNormalBrush}" />
|
2025-09-08 19:49:09 +08:00
|
|
|
<Setter Property="Foreground" Value="White" />
|
2025-08-20 12:10:13 +08:00
|
|
|
</Trigger>
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
</Style>
|
|
|
|
|
|
|
|
|
|
<!-- 主 TimePicker 样式 -->
|
|
|
|
|
<Style TargetType="{x:Type controls:TimePicker}">
|
2025-08-24 13:49:55 +08:00
|
|
|
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
2025-12-28 11:47:54 +08:00
|
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
2025-08-24 13:49:55 +08:00
|
|
|
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
|
2025-12-28 11:47:54 +08:00
|
|
|
<Setter Property="BorderThickness" Value="0" />
|
2025-12-23 21:35:54 +08:00
|
|
|
<Setter Property="FontSize" Value="14" />
|
2025-12-28 11:47:54 +08:00
|
|
|
<Setter Property="HorizontalAlignment" Value="Center" />
|
2025-09-08 19:49:09 +08:00
|
|
|
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
2025-08-20 12:10:13 +08:00
|
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
2025-09-08 19:49:09 +08:00
|
|
|
<Setter Property="Padding" Value="10,4" />
|
2025-08-20 12:10:13 +08:00
|
|
|
<Setter Property="Template">
|
|
|
|
|
<Setter.Value>
|
|
|
|
|
<ControlTemplate TargetType="{x:Type controls:TimePicker}">
|
2025-09-08 19:49:09 +08:00
|
|
|
<Grid x:Name="templateRoot">
|
2025-12-28 11:47:54 +08:00
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
<ColumnDefinition Width="Auto" />
|
|
|
|
|
<ColumnDefinition Width="*" />
|
|
|
|
|
</Grid.ColumnDefinitions>
|
2025-08-20 12:10:13 +08:00
|
|
|
<Popup
|
2026-02-20 15:31:44 +08:00
|
|
|
x:Name="TimePickerPopup"
|
|
|
|
|
assists:BehaviorAssist.SimulateNativeBehavior="True"
|
2025-08-20 12:10:13 +08:00
|
|
|
AllowsTransparency="True"
|
2025-09-08 19:49:09 +08:00
|
|
|
Effect="{DynamicResource PopupShadow}"
|
2025-08-20 12:10:13 +08:00
|
|
|
IsOpen="{Binding IsChecked, ElementName=PART_ToggleButton, Mode=TwoWay}"
|
|
|
|
|
Placement="Bottom"
|
|
|
|
|
PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
|
|
|
|
|
PopupAnimation="Fade"
|
2026-02-20 15:31:44 +08:00
|
|
|
StaysOpen="True">
|
2025-08-20 12:10:13 +08:00
|
|
|
<Border
|
2026-02-20 15:31:44 +08:00
|
|
|
MinWidth="{Binding ActualWidth, ElementName=templateRoot}"
|
|
|
|
|
Margin="10"
|
2025-09-08 19:49:09 +08:00
|
|
|
Background="{DynamicResource BackgroundFloatingBrush}"
|
2025-08-20 12:10:13 +08:00
|
|
|
CornerRadius="8"
|
2026-02-20 15:31:44 +08:00
|
|
|
Effect="{DynamicResource PopupShadow}">
|
2025-09-08 19:49:09 +08:00
|
|
|
|
2025-08-20 12:10:13 +08:00
|
|
|
<Grid>
|
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
|
<RowDefinition Height="*" />
|
|
|
|
|
<RowDefinition Height="Auto" />
|
|
|
|
|
</Grid.RowDefinitions>
|
|
|
|
|
<StackPanel
|
|
|
|
|
Grid.Row="0"
|
2025-09-08 19:49:09 +08:00
|
|
|
Margin="2"
|
2025-08-20 12:10:13 +08:00
|
|
|
Orientation="Horizontal">
|
|
|
|
|
<ListBox
|
2026-02-20 15:31:44 +08:00
|
|
|
x:Name="HourSelector"
|
|
|
|
|
Width="80"
|
|
|
|
|
MaxHeight="240"
|
2025-08-20 12:10:13 +08:00
|
|
|
Background="Transparent"
|
|
|
|
|
BorderThickness="0"
|
2026-02-20 15:31:44 +08:00
|
|
|
ItemContainerStyle="{StaticResource TimePickerFlyoutListBoxItemStyle}" />
|
2026-01-02 17:30:30 +08:00
|
|
|
<ListBox
|
2026-02-20 15:31:44 +08:00
|
|
|
x:Name="MinuteSelector"
|
|
|
|
|
Width="80"
|
|
|
|
|
MaxHeight="240"
|
2025-08-20 12:10:13 +08:00
|
|
|
Background="Transparent"
|
|
|
|
|
BorderThickness="0"
|
2026-02-20 15:31:44 +08:00
|
|
|
ItemContainerStyle="{StaticResource TimePickerFlyoutListBoxItemStyle}" />
|
2026-01-02 17:30:30 +08:00
|
|
|
<ListBox
|
2026-02-20 15:31:44 +08:00
|
|
|
x:Name="PeriodSelector"
|
|
|
|
|
Width="80"
|
|
|
|
|
MaxHeight="240"
|
2025-08-20 12:10:13 +08:00
|
|
|
Background="Transparent"
|
|
|
|
|
BorderThickness="0"
|
2026-02-20 15:31:44 +08:00
|
|
|
ItemContainerStyle="{StaticResource TimePickerFlyoutListBoxItemStyle}" />
|
2025-08-20 12:10:13 +08:00
|
|
|
</StackPanel>
|
|
|
|
|
<Border
|
2026-01-02 17:30:30 +08:00
|
|
|
Grid.Row="1"
|
2026-02-20 15:31:44 +08:00
|
|
|
Padding="5"
|
|
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
BorderThickness="0,1,0,0">
|
2025-08-20 12:10:13 +08:00
|
|
|
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
|
|
|
|
|
<Button
|
2026-02-20 15:31:44 +08:00
|
|
|
x:Name="AcceptButton"
|
2025-10-10 11:19:58 +08:00
|
|
|
Style="{StaticResource FlattenButtonStyle}"
|
2026-02-20 15:31:44 +08:00
|
|
|
ToolTip="Accept">
|
2025-09-08 19:49:09 +08:00
|
|
|
<controls:IconElement Symbol="Check" />
|
|
|
|
|
</Button>
|
2025-08-20 12:10:13 +08:00
|
|
|
<Button
|
2026-02-20 15:31:44 +08:00
|
|
|
x:Name="DismissButton"
|
2025-08-20 12:10:13 +08:00
|
|
|
Margin="5,0,0,0"
|
2025-10-10 11:19:58 +08:00
|
|
|
Style="{StaticResource FlattenButtonStyle}"
|
2026-02-20 15:31:44 +08:00
|
|
|
ToolTip="Dismiss">
|
2025-09-08 19:49:09 +08:00
|
|
|
<controls:IconElement Symbol="Close" />
|
|
|
|
|
</Button>
|
2025-08-20 12:10:13 +08:00
|
|
|
</StackPanel>
|
|
|
|
|
</Border>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Border>
|
|
|
|
|
</Popup>
|
2025-09-08 19:49:09 +08:00
|
|
|
<!-- Header -->
|
|
|
|
|
<ContentPresenter
|
2026-01-02 17:30:30 +08:00
|
|
|
Grid.Row="0"
|
2026-02-20 15:31:44 +08:00
|
|
|
Grid.Column="0"
|
2025-10-10 11:19:58 +08:00
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
2026-02-20 15:31:44 +08:00
|
|
|
VerticalAlignment="Center"
|
|
|
|
|
Content="{TemplateBinding Header}"
|
|
|
|
|
ContentSource="Header" />
|
2025-08-20 12:10:13 +08:00
|
|
|
<!-- 使用ToggleButton作为点击触发器 -->
|
|
|
|
|
<ToggleButton
|
2026-02-20 15:31:44 +08:00
|
|
|
x:Name="PART_ToggleButton"
|
|
|
|
|
Grid.Column="1"
|
|
|
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
2025-08-20 12:10:13 +08:00
|
|
|
Background="{TemplateBinding Background}"
|
2025-12-28 11:47:54 +08:00
|
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
|
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
2026-02-20 15:31:44 +08:00
|
|
|
Cursor="Hand">
|
2025-09-08 19:49:09 +08:00
|
|
|
<!-- 主显示区域 -->
|
2026-02-20 15:31:44 +08:00
|
|
|
<Border x:Name="ContentBorder" HorizontalAlignment="Center">
|
2025-09-08 19:49:09 +08:00
|
|
|
<StackPanel Orientation="Horizontal">
|
|
|
|
|
<TextBlock
|
2026-02-20 15:31:44 +08:00
|
|
|
x:Name="HourTextBlock"
|
2025-12-23 21:35:54 +08:00
|
|
|
Padding="0,0,6,0"
|
2025-09-08 19:49:09 +08:00
|
|
|
VerticalAlignment="Center"
|
2026-02-20 15:31:44 +08:00
|
|
|
Text="--" />
|
2025-10-10 11:19:58 +08:00
|
|
|
<TextBlock
|
|
|
|
|
Margin="4,0"
|
2026-02-20 15:31:44 +08:00
|
|
|
VerticalAlignment="Center"
|
|
|
|
|
Text=":" />
|
2025-09-08 19:49:09 +08:00
|
|
|
<TextBlock
|
2026-02-20 15:31:44 +08:00
|
|
|
x:Name="MinuteTextBlock"
|
2025-12-23 21:35:54 +08:00
|
|
|
Padding="6,0,0,0"
|
2025-09-08 19:49:09 +08:00
|
|
|
VerticalAlignment="Center"
|
2026-02-20 15:31:44 +08:00
|
|
|
Text="--" />
|
2025-09-08 19:49:09 +08:00
|
|
|
<TextBlock
|
2026-02-20 15:31:44 +08:00
|
|
|
x:Name="PeriodTextBlock"
|
2025-09-08 19:49:09 +08:00
|
|
|
Margin="8,0"
|
2026-02-20 15:31:44 +08:00
|
|
|
Text="AM" />
|
2025-09-08 19:49:09 +08:00
|
|
|
</StackPanel>
|
|
|
|
|
</Border>
|
2025-08-20 12:10:13 +08:00
|
|
|
</ToggleButton>
|
|
|
|
|
</Grid>
|
|
|
|
|
|
|
|
|
|
<ControlTemplate.Triggers>
|
2025-12-28 11:47:54 +08:00
|
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
|
|
|
<Setter Property="Background" Value="{DynamicResource ControlBackgroundHoverBrush}" />
|
|
|
|
|
</Trigger>
|
2025-08-20 12:10:13 +08:00
|
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
|
|
|
<Setter Property="Opacity" Value="0.5" />
|
|
|
|
|
</Trigger>
|
|
|
|
|
<Trigger Property="ClockIdentifier" Value="Clock24Hour">
|
2026-02-20 15:31:44 +08:00
|
|
|
<Setter TargetName="PeriodTextBlock" Property="Visibility" Value="Collapsed" />
|
|
|
|
|
<Setter TargetName="PeriodSelector" Property="Visibility" Value="Collapsed" />
|
2025-08-20 12:10:13 +08:00
|
|
|
</Trigger>
|
|
|
|
|
</ControlTemplate.Triggers>
|
|
|
|
|
</ControlTemplate>
|
|
|
|
|
</Setter.Value>
|
|
|
|
|
</Setter>
|
|
|
|
|
</Style>
|
|
|
|
|
|
|
|
|
|
</ResourceDictionary>
|