feat: adjust TopLevel MenuItem.

This commit is contained in:
Zhang Dian
2025-03-07 01:02:16 +08:00
parent 8094582911
commit f30b2dc263
2 changed files with 5 additions and 3 deletions

View File

@@ -303,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
@@ -326,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

@@ -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>