Merge branch 'refs/heads/main' into typesetting

# Conflicts:
#	src/Semi.Avalonia/Controls/Calendar.axaml
#	src/Semi.Avalonia/Controls/TimePicker.axaml
This commit is contained in:
Zhang Dian
2025-03-07 14:49:37 +08:00
6 changed files with 29 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
<ResourceDictionary <ResourceDictionary
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:ClassModifier="internal"> x:CompileBindings="True">
<ControlTheme x:Key="{x:Type AdornerLayer}" TargetType="AdornerLayer"> <ControlTheme x:Key="{x:Type AdornerLayer}" TargetType="AdornerLayer">
<Setter Property="DefaultFocusAdorner"> <Setter Property="DefaultFocusAdorner">
<FocusAdornerTemplate> <FocusAdornerTemplate>

View File

@@ -2,6 +2,11 @@
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:CompileBindings="True"> x:CompileBindings="True">
<Design.PreviewWith>
<Border Padding="20">
<Calendar />
</Border>
</Design.PreviewWith>
<ControlTheme x:Key="{x:Type Calendar}" TargetType="Calendar"> <ControlTheme x:Key="{x:Type Calendar}" TargetType="Calendar">
<Setter Property="Foreground" Value="{DynamicResource CalendarForeground}" /> <Setter Property="Foreground" Value="{DynamicResource CalendarForeground}" />
<Setter Property="Background" Value="{DynamicResource CalendarBackground}" /> <Setter Property="Background" Value="{DynamicResource CalendarBackground}" />
@@ -38,6 +43,7 @@
VerticalAlignment="Center" VerticalAlignment="Center"
x:DataType="x:String" x:DataType="x:String"
FontSize="{DynamicResource CalendarItemWeekDayNameFontSize}" FontSize="{DynamicResource CalendarItemWeekDayNameFontSize}"
FontWeight="{DynamicResource CalendarItemWeekDayNameFontWeight}"
Foreground="{DynamicResource CalendarItemWeekDayNameForeground}" Foreground="{DynamicResource CalendarItemWeekDayNameForeground}"
Text="{Binding}" /> Text="{Binding}" />
</Template> </Template>
@@ -58,38 +64,41 @@
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
RowDefinitions="Auto,*"> RowDefinitions="Auto,*">
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto"> <Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto">
<Button <RepeatButton
Name="PART_PreviousButton" Name="PART_PreviousButton"
Grid.Column="0" Grid.Column="0"
HorizontalContentAlignment="Left" Padding="0"
MinWidth="{Binding $self.MinHeight}"
Foreground="{TemplateBinding Foreground}" Foreground="{TemplateBinding Foreground}"
Theme="{DynamicResource BorderlessButton}"> Theme="{DynamicResource BorderlessRepeatButton}">
<PathIcon <PathIcon
Theme="{DynamicResource InnerPathIcon}" Theme="{DynamicResource InnerPathIcon}"
Classes="Large" Classes="Large"
Data="{DynamicResource CalendarItemPreviousIconGlyph}" Data="{DynamicResource CalendarItemPreviousIconGlyph}"
Foreground="{DynamicResource CalendarItemIconForeground}" /> Foreground="{DynamicResource CalendarItemIconForeground}" />
</Button> </RepeatButton>
<Button <Button
Name="PART_HeaderButton" Name="PART_HeaderButton"
Grid.Column="1" Grid.Column="1"
HorizontalContentAlignment="Center" HorizontalContentAlignment="Center"
HorizontalAlignment="Stretch"
Foreground="{TemplateBinding Foreground}" Foreground="{TemplateBinding Foreground}"
Theme="{DynamicResource BorderlessButton}" /> Theme="{DynamicResource BorderlessButton}" />
<Button <RepeatButton
Name="PART_NextButton" Name="PART_NextButton"
Grid.Column="2" Grid.Column="2"
HorizontalContentAlignment="Left" Padding="0"
MinWidth="{Binding $self.MinHeight}"
Foreground="{TemplateBinding Foreground}" Foreground="{TemplateBinding Foreground}"
Theme="{DynamicResource BorderlessButton}"> Theme="{DynamicResource BorderlessRepeatButton}">
<PathIcon <PathIcon
Theme="{DynamicResource InnerPathIcon}" Theme="{DynamicResource InnerPathIcon}"
Classes="Large" Classes="Large"
Data="{DynamicResource CalendarItemNextIconGlyph}" Data="{DynamicResource CalendarItemNextIconGlyph}"
Foreground="{DynamicResource CalendarItemIconForeground}" /> Foreground="{DynamicResource CalendarItemIconForeground}" />
</Button> </RepeatButton>
</Grid> </Grid>
<Grid <Grid
Name="PART_MonthView" Name="PART_MonthView"

View File

@@ -24,6 +24,7 @@
Command="{Binding LineUp, RelativeSource={RelativeSource TemplatedParent}}" Command="{Binding LineUp, RelativeSource={RelativeSource TemplatedParent}}"
CornerRadius="0" CornerRadius="0"
MinHeight="0" MinHeight="0"
Padding="0 4"
DockPanel.Dock="Top" DockPanel.Dock="Top"
RenderTransform="{x:Null}"> RenderTransform="{x:Null}">
<RepeatButton.IsVisible> <RepeatButton.IsVisible>
@@ -49,8 +50,9 @@
BorderThickness="0" BorderThickness="0"
Command="{Binding LineDown, RelativeSource={RelativeSource TemplatedParent}}" Command="{Binding LineDown, RelativeSource={RelativeSource TemplatedParent}}"
CornerRadius="0" CornerRadius="0"
DockPanel.Dock="Bottom"
MinHeight="0" MinHeight="0"
Padding="0 4"
DockPanel.Dock="Bottom"
RenderTransform="{x:Null}"> RenderTransform="{x:Null}">
<RepeatButton.IsVisible> <RepeatButton.IsVisible>
<MultiBinding <MultiBinding
@@ -301,7 +303,8 @@
<Setter Property="Cursor" Value="Hand" /> <Setter Property="Cursor" Value="Hand" />
<Setter Property="CornerRadius" Value="{DynamicResource MenuItemCornerRadius}" /> <Setter Property="CornerRadius" Value="{DynamicResource MenuItemCornerRadius}" />
<!-- Narrow padding should be used for mouse input, when non-narrow one should be used for touch input in future. --> <!-- Narrow padding should be used for mouse input, when non-narrow one should be used for touch input in future. -->
<Setter Property="Padding" Value="{DynamicResource MenuItemPadding}" /> <Setter Property="Padding" Value="{DynamicResource TopLevelMenuItemPadding}" />
<Setter Property="MinHeight" Value="{DynamicResource TopLevelMenuItemMinHeight}" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Border <Border
@@ -324,8 +327,7 @@
MinWidth="{Binding $parent[MenuItem].Bounds.Width}" MinWidth="{Binding $parent[MenuItem].Bounds.Width}"
HorizontalOffset="-8" HorizontalOffset="-8"
IsLightDismissEnabled="True" IsLightDismissEnabled="True"
IsOpen="{TemplateBinding IsSubMenuOpen, IsOpen="{TemplateBinding IsSubMenuOpen,Mode=TwoWay}"
Mode=TwoWay}"
OverlayInputPassThroughElement="{Binding $parent[Menu]}" OverlayInputPassThroughElement="{Binding $parent[Menu]}"
Placement="BottomEdgeAlignedLeft" Placement="BottomEdgeAlignedLeft"
VerticalOffset="-4" VerticalOffset="-4"

View File

@@ -11,6 +11,7 @@
<Setter Property="Width" Value="242" /> <Setter Property="Width" Value="242" />
<Setter Property="MinWidth" Value="242" /> <Setter Property="MinWidth" Value="242" />
<Setter Property="MaxHeight" Value="300" /> <Setter Property="MaxHeight" Value="300" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="Background" Value="{DynamicResource DateTimePickerPopupBackground}" /> <Setter Property="Background" Value="{DynamicResource DateTimePickerPopupBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DateTimePickerPopupBorderBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource DateTimePickerPopupBorderBrush}" />
<Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderThickness" Value="1" />
@@ -158,7 +159,7 @@
<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}" />
<Setter Property="BorderThickness" Value="1" /> <Setter Property="BorderThickness" Value="{DynamicResource DateTimePickerButtonBorderThickness}" />
<Setter Property="CornerRadius" Value="{DynamicResource DateTimePickerButtonCornerRadius}" /> <Setter Property="CornerRadius" Value="{DynamicResource DateTimePickerButtonCornerRadius}" />
<Setter Property="HorizontalAlignment" Value="Left" /> <Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="VerticalAlignment" Value="Center" />

View File

@@ -2,6 +2,7 @@
<StaticResource x:Key="CalendarBorderThickness" ResourceKey="SemiBorderThicknessControl" /> <StaticResource x:Key="CalendarBorderThickness" ResourceKey="SemiBorderThicknessControl" />
<StaticResource x:Key="CalendarCornerRadius" ResourceKey="SemiBorderRadiusMedium" /> <StaticResource x:Key="CalendarCornerRadius" ResourceKey="SemiBorderRadiusMedium" />
<GridLength x:Key="CalendarItemWeekDayNameHeight">40</GridLength> <GridLength x:Key="CalendarItemWeekDayNameHeight">40</GridLength>
<StaticResource x:Key="CalendarItemWeekDayNameFontWeight" ResourceKey="SemiFontWeightBold" />
<StaticResource x:Key="CalendarItemPreviousIconGlyph" ResourceKey="SemiIconChevronLeft" /> <StaticResource x:Key="CalendarItemPreviousIconGlyph" ResourceKey="SemiIconChevronLeft" />
<StaticResource x:Key="CalendarItemNextIconGlyph" ResourceKey="SemiIconChevronRight" /> <StaticResource x:Key="CalendarItemNextIconGlyph" ResourceKey="SemiIconChevronRight" />
<StaticResource x:Key="CalendarItemCalendarButtonSelectedFontWeight" ResourceKey="SemiFontWeightBold" /> <StaticResource x:Key="CalendarItemCalendarButtonSelectedFontWeight" ResourceKey="SemiFontWeightBold" />

View File

@@ -12,6 +12,8 @@
<x:Double x:Key="MenuFlyoutMaxHeight">400</x:Double> <x:Double x:Key="MenuFlyoutMaxHeight">400</x:Double>
<x:Double x:Key="MenuFlyoutMaxWidth">600</x:Double> <x:Double x:Key="MenuFlyoutMaxWidth">600</x:Double>
<!-- MenuItem --> <!-- MenuItem -->
<Thickness x:Key="TopLevelMenuItemPadding">16 0</Thickness>
<StaticResource x:Key="TopLevelMenuItemMinHeight" ResourceKey="SemiHeightControlDefault" />
<Thickness x:Key="MenuItemPadding">16 8</Thickness> <Thickness x:Key="MenuItemPadding">16 8</Thickness>
<StaticResource x:Key="MenuItemCornerRadius" ResourceKey="SemiBorderRadiusSmall" /> <StaticResource x:Key="MenuItemCornerRadius" ResourceKey="SemiBorderRadiusSmall" />
<x:Double x:Key="MenuItemSeparatorHeight">1</x:Double> <x:Double x:Key="MenuItemSeparatorHeight">1</x:Double>