Merge pull request #553 from irihitech/various

fix various issues
This commit is contained in:
Dong Bin
2025-03-07 13:13:15 +08:00
committed by GitHub
6 changed files with 28 additions and 14 deletions

View File

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

View File

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

View File

@@ -24,6 +24,7 @@
Command="{Binding LineUp, RelativeSource={RelativeSource TemplatedParent}}"
CornerRadius="0"
MinHeight="0"
Padding="0 4"
DockPanel.Dock="Top"
RenderTransform="{x:Null}">
<RepeatButton.IsVisible>
@@ -49,8 +50,9 @@
BorderThickness="0"
Command="{Binding LineDown, RelativeSource={RelativeSource TemplatedParent}}"
CornerRadius="0"
DockPanel.Dock="Bottom"
MinHeight="0"
Padding="0 4"
DockPanel.Dock="Bottom"
RenderTransform="{x:Null}">
<RepeatButton.IsVisible>
<MultiBinding
@@ -301,7 +303,8 @@
<Setter Property="Cursor" Value="Hand" />
<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. -->
<Setter Property="Padding" Value="{DynamicResource MenuItemPadding}" />
<Setter Property="Padding" Value="{DynamicResource TopLevelMenuItemPadding}" />
<Setter Property="MinHeight" Value="{DynamicResource TopLevelMenuItemMinHeight}" />
<Setter Property="Template">
<ControlTemplate>
<Border
@@ -324,8 +327,7 @@
MinWidth="{Binding $parent[MenuItem].Bounds.Width}"
HorizontalOffset="-8"
IsLightDismissEnabled="True"
IsOpen="{TemplateBinding IsSubMenuOpen,
Mode=TwoWay}"
IsOpen="{TemplateBinding IsSubMenuOpen,Mode=TwoWay}"
OverlayInputPassThroughElement="{Binding $parent[Menu]}"
Placement="BottomEdgeAlignedLeft"
VerticalOffset="-4"

View File

@@ -157,7 +157,7 @@
<Setter Property="Foreground" Value="{DynamicResource DateTimePickerButtonForeground}" />
<Setter Property="Background" Value="{DynamicResource DateTimePickerButtonBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DateTimePickerButtonBorderBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderThickness" Value="{DynamicResource DateTimePickerButtonBorderThickness}" />
<Setter Property="CornerRadius" Value="3" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />

View File

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

View File

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