feat: DateTime picker theme.

This commit is contained in:
rabbitism 2023-02-16 23:58:55 +08:00
parent 068f1e36cc
commit 4e5a6c327d
4 changed files with 14 additions and 9 deletions

View File

@ -125,7 +125,7 @@
<ControlTheme x:Key="{x:Type DatePicker}" TargetType="DatePicker"> <ControlTheme x:Key="{x:Type DatePicker}" TargetType="DatePicker">
<Setter Property="FontSize" Value="14" /> <Setter Property="FontSize" Value="14" />
<Setter Property="Height" Value="30" /> <Setter Property="Height" Value="32" />
<Setter Property="Foreground" Value="{DynamicResource DateTimePickerButtonForeground}" /> <Setter Property="Foreground" Value="{DynamicResource DateTimePickerButtonForeground}" />
<Setter Property="Background" Value="{DynamicResource DateTimePickerButtonBackground}" /> <Setter Property="Background" Value="{DynamicResource DateTimePickerButtonBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DateTimePickerButtonBorderBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource DateTimePickerButtonBorderBrush}" />
@ -141,7 +141,7 @@
Width="298" Width="298"
MinWidth="298" MinWidth="298"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Top" VerticalAlignment="Stretch"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
@ -154,6 +154,7 @@
<Grid <Grid
Name="PART_ButtonContentGrid" Name="PART_ButtonContentGrid"
Grid.Column="0" Grid.Column="0"
VerticalAlignment="Center"
ColumnDefinitions="78*,Auto,132*,Auto,78*"> ColumnDefinitions="78*,Auto,132*,Auto,78*">
<TextBlock <TextBlock
Name="PART_DayTextBlock" Name="PART_DayTextBlock"

View File

@ -3,6 +3,7 @@
<ControlTheme x:Key="DateTimePickerFlyoutButton" TargetType="Button"> <ControlTheme x:Key="DateTimePickerFlyoutButton" TargetType="Button">
<Setter Property="RenderTransform" Value="none" /> <Setter Property="RenderTransform" Value="none" />
<Setter Property="Button.VerticalAlignment" Value="Stretch" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<ContentPresenter <ContentPresenter
@ -19,7 +20,7 @@
</Setter> </Setter>
<Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter"> <Style Selector="^:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="BorderBrush" Value="{DynamicResource DateTimePickerButtonPointeroverBorderBrush}" /> <Setter Property="Background" Value="{DynamicResource DateTimePickerButtonPointeroverBackground}" />
</Style> </Style>
<Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter"> <Style Selector="^:disabled /template/ ContentPresenter#PART_ContentPresenter">

View File

@ -128,7 +128,7 @@
<ControlTheme x:Key="{x:Type TimePicker}" TargetType="TimePicker"> <ControlTheme x:Key="{x:Type TimePicker}" TargetType="TimePicker">
<Setter Property="FontSize" Value="14" /> <Setter Property="FontSize" Value="14" />
<Setter Property="Height" Value="30" /> <Setter Property="Height" Value="32" />
<Setter Property="Foreground" Value="{DynamicResource DateTimePickerButtonForeground}" /> <Setter Property="Foreground" Value="{DynamicResource DateTimePickerButtonForeground}" />
<Setter Property="Background" Value="{DynamicResource DateTimePickerButtonBackground}" /> <Setter Property="Background" Value="{DynamicResource DateTimePickerButtonBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DateTimePickerButtonBorderBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource DateTimePickerButtonBorderBrush}" />
@ -144,7 +144,7 @@
Width="242" Width="242"
MinWidth="242" MinWidth="242"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Top" VerticalAlignment="Stretch"
Background="{TemplateBinding Background}" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
@ -165,6 +165,7 @@
x:Name="PART_HourTextBlock" x:Name="PART_HourTextBlock"
Padding="12,4" Padding="12,4"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{TemplateBinding FontFamily}" FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}" FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}" /> FontWeight="{TemplateBinding FontWeight}" />
@ -187,6 +188,7 @@
x:Name="PART_MinuteTextBlock" x:Name="PART_MinuteTextBlock"
Padding="12,4" Padding="12,4"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{TemplateBinding FontFamily}" FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}" FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}" /> FontWeight="{TemplateBinding FontWeight}" />
@ -209,6 +211,7 @@
x:Name="PART_PeriodTextBlock" x:Name="PART_PeriodTextBlock"
Padding="12,4" Padding="12,4"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{TemplateBinding FontFamily}" FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}" FontSize="{TemplateBinding FontSize}"
FontWeight="{TemplateBinding FontWeight}" /> FontWeight="{TemplateBinding FontWeight}" />

View File

@ -23,15 +23,15 @@
<sys:Double x:Key="DateTimePickerListBoxItemHeight">28</sys:Double> <sys:Double x:Key="DateTimePickerListBoxItemHeight">28</sys:Double>
<SolidColorBrush x:Key="DateTimePickerButtonBorderBrush" Color="#C6CACD" /> <SolidColorBrush x:Key="DateTimePickerButtonBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="DateTimePickerButtonBackground" Color="Transparent" /> <SolidColorBrush x:Key="DateTimePickerButtonBackground" Opacity="0.05" Color="#FF2E3238" />
<SolidColorBrush x:Key="DateTimePickerButtonForeground" Color="#1C1F23" /> <SolidColorBrush x:Key="DateTimePickerButtonForeground" Color="#1C1F23" />
<SolidColorBrush x:Key="DateTimePickerIconForeground" Opacity="0.62" Color="#1C1F23" /> <SolidColorBrush x:Key="DateTimePickerIconForeground" Opacity="0.62" Color="#1C1F23" />
<SolidColorBrush x:Key="DateTimePickerEmptyForeground" Opacity="0.5" Color="#1C1F23" /> <SolidColorBrush x:Key="DateTimePickerEmptyForeground" Opacity="0.5" Color="#1C1F23" />
<SolidColorBrush x:Key="DateTimePickerButtonPointeroverBorderBrush" Color="#0062D6" /> <SolidColorBrush x:Key="DateTimePickerButtonPointeroverBackground" Opacity="0.09" Color="#FF2E3238" />
<SolidColorBrush x:Key="DateTimePickerButtonDisabledBorderBrush" Color="#F9F9F9" /> <SolidColorBrush x:Key="DateTimePickerButtonDisabledBorderBrush" Color="Transparent" />
<SolidColorBrush x:Key="DateTimePickerButtonDisabledBackground" Color="#F9F9F9" /> <SolidColorBrush x:Key="DateTimePickerButtonDisabledBackground" Color="#F9F9F9" />
<SolidColorBrush x:Key="DateTimePickerButtonDisabledIconForeground" Opacity="0.4" Color="#2E3238" /> <SolidColorBrush x:Key="DateTimePickerButtonDisabledIconForeground" Opacity="0.4" Color="#2E3238" />