Browse Source

Fix DatePicker and TimePicker separator alignment with VerticalContentAlignment (#22023)

* Fix DatePicker and TimePicker separator alignment with VerticalContentAlignment

* Fix DatePicker and TimePicker separator alignment in Simple Theme

---------

Co-authored-by: Javier Suárez <javiersuarezruiz@hotmail.com>
pull/22069/head
Yoyo 2 months ago
committed by GitHub
parent
commit
f1e09e4e31
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      src/Avalonia.Themes.Fluent/Controls/DatePicker.xaml
  2. 6
      src/Avalonia.Themes.Fluent/Controls/TimePicker.xaml
  3. 7
      src/Avalonia.Themes.Simple/Controls/DatePicker.xaml
  4. 6
      src/Avalonia.Themes.Simple/Controls/TimePicker.xaml

6
src/Avalonia.Themes.Fluent/Controls/DatePicker.xaml

@ -98,7 +98,7 @@
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
TemplatedControl.IsTemplateFocusTarget="True"> TemplatedControl.IsTemplateFocusTarget="True">
<Grid Name="PART_ButtonContentGrid" ColumnDefinitions="78*,Auto,132*,Auto,78*" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> <Grid Name="PART_ButtonContentGrid" ColumnDefinitions="78*,Auto,132*,Auto,78*">
<TextBlock Name="PART_DayTextBlock" Text="{DynamicResource StringDatePickerDayText}" HorizontalAlignment="Center" <TextBlock Name="PART_DayTextBlock" Text="{DynamicResource StringDatePickerDayText}" HorizontalAlignment="Center"
Padding="{DynamicResource DatePickerHostPadding}" /> Padding="{DynamicResource DatePickerHostPadding}" />
<TextBlock Name="PART_MonthTextBlock" Text="{DynamicResource StringDatePickerMonthText}" TextAlignment="Left" <TextBlock Name="PART_MonthTextBlock" Text="{DynamicResource StringDatePickerMonthText}" TextAlignment="Left"
@ -133,6 +133,10 @@
<Setter Property="Fill" Value="{DynamicResource DatePickerSpacerFillDisabled}"/> <Setter Property="Fill" Value="{DynamicResource DatePickerSpacerFillDisabled}"/>
</Style> </Style>
<Style Selector="^ /template/ Button#PART_FlyoutButton TextBlock">
<Setter Property="VerticalAlignment" Value="{TemplateBinding VerticalContentAlignment}"/>
</Style>
<!-- Changes foreground for watermark text when SelectedDate is null--> <!-- Changes foreground for watermark text when SelectedDate is null-->
<Style Selector="^:hasnodate /template/ Button#PART_FlyoutButton TextBlock"> <Style Selector="^:hasnodate /template/ Button#PART_FlyoutButton TextBlock">
<Setter Property="Foreground" Value="{DynamicResource TextControlPlaceholderForeground}"/> <Setter Property="Foreground" Value="{DynamicResource TextControlPlaceholderForeground}"/>

6
src/Avalonia.Themes.Fluent/Controls/TimePicker.xaml

@ -97,7 +97,7 @@
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"> VerticalAlignment="Stretch">
<Grid Name="PART_FlyoutButtonContentGrid" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> <Grid Name="PART_FlyoutButtonContentGrid">
<!--Ignore col defs here, set in code--> <!--Ignore col defs here, set in code-->
<Border x:Name="PART_FirstPickerHost" <Border x:Name="PART_FirstPickerHost"
Grid.Column="0" Grid.Column="0"
@ -175,6 +175,10 @@
<Setter Property="Fill" Value="{DynamicResource TimePickerSpacerFillDisabled}"/> <Setter Property="Fill" Value="{DynamicResource TimePickerSpacerFillDisabled}"/>
</Style> </Style>
<Style Selector="^ /template/ Button#PART_FlyoutButton TextBlock">
<Setter Property="VerticalAlignment" Value="{TemplateBinding VerticalContentAlignment}"/>
</Style>
<Style Selector="^:hasnotime /template/ Button#PART_FlyoutButton TextBlock"> <Style Selector="^:hasnotime /template/ Button#PART_FlyoutButton TextBlock">
<Setter Property="Foreground" Value="{DynamicResource TextControlPlaceholderForeground}"/> <Setter Property="Foreground" Value="{DynamicResource TextControlPlaceholderForeground}"/>
</Style> </Style>

7
src/Avalonia.Themes.Simple/Controls/DatePicker.xaml

@ -106,8 +106,7 @@
TemplatedControl.IsTemplateFocusTarget="True" TemplatedControl.IsTemplateFocusTarget="True"
Theme="{StaticResource SimpleDatePickerFlyoutButton}"> Theme="{StaticResource SimpleDatePickerFlyoutButton}">
<Grid Name="PART_ButtonContentGrid" <Grid Name="PART_ButtonContentGrid"
ColumnDefinitions="78*,Auto,132*,Auto,78*" ColumnDefinitions="78*,Auto,132*,Auto,78*">
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<TextBlock Name="PART_DayTextBlock" <TextBlock Name="PART_DayTextBlock"
Padding="{DynamicResource DatePickerHostPadding}" Padding="{DynamicResource DatePickerHostPadding}"
HorizontalAlignment="Center" HorizontalAlignment="Center"
@ -159,6 +158,10 @@
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" /> <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
</Style> </Style>
<Style Selector="^ /template/ Button#PART_FlyoutButton TextBlock">
<Setter Property="VerticalAlignment" Value="{TemplateBinding VerticalContentAlignment}"/>
</Style>
<!-- Changes foreground for watermark text when SelectedDate is null --> <!-- Changes foreground for watermark text when SelectedDate is null -->
<Style Selector="^:hasnodate /template/ Button#PART_FlyoutButton TextBlock"> <Style Selector="^:hasnodate /template/ Button#PART_FlyoutButton TextBlock">
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLowBrush}" /> <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLowBrush}" />

6
src/Avalonia.Themes.Simple/Controls/TimePicker.xaml

@ -103,7 +103,7 @@
IsEnabled="{TemplateBinding IsEnabled}" IsEnabled="{TemplateBinding IsEnabled}"
Theme="{StaticResource SimpleTimePickerFlyoutButton}"> Theme="{StaticResource SimpleTimePickerFlyoutButton}">
<Grid Name="PART_FlyoutButtonContentGrid" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> <Grid Name="PART_FlyoutButtonContentGrid">
<!-- Ignore col defs here, set in code --> <!-- Ignore col defs here, set in code -->
<Border x:Name="PART_FirstPickerHost" <Border x:Name="PART_FirstPickerHost"
Grid.Column="0" Grid.Column="0"
@ -192,6 +192,10 @@
<Style Selector="^:disabled /template/ Rectangle"> <Style Selector="^:disabled /template/ Rectangle">
<Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" /> <Setter Property="Opacity" Value="{DynamicResource ThemeDisabledOpacity}" />
</Style> </Style>
<Style Selector="^ /template/ Button#PART_FlyoutButton TextBlock">
<Setter Property="VerticalAlignment" Value="{TemplateBinding VerticalContentAlignment}"/>
</Style>
<Style Selector="^:hasnotime /template/ Button#PART_FlyoutButton TextBlock"> <Style Selector="^:hasnotime /template/ Button#PART_FlyoutButton TextBlock">
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLowBrush}" /> <Setter Property="Foreground" Value="{DynamicResource ThemeForegroundLowBrush}" />

Loading…
Cancel
Save