feat: add avalonia menu style (step2).

This commit is contained in:
NaBian committed 2025-09-23 23:45:25 +08:00
1 parent b6ccc7330c
commit 61464afd3f
11 files changed
+110 -52

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Nullable>enable</Nullable>
<AvaloniaVersion>11.3.4</AvaloniaVersion>
<AvaloniaVersion>11.3.6</AvaloniaVersion>
</PropertyGroup>
</Project>
@@ -5,7 +5,7 @@ namespace HandyControl.Controls;
public class MenuAttach
{
public static readonly AttachedProperty<double> PopupVerticalOffsetProperty =
AvaloniaProperty.RegisterAttached<MenuAttach, AvaloniaObject, double>("PopupVerticalOffset");
AvaloniaProperty.RegisterAttached<MenuAttach, AvaloniaObject, double>("PopupVerticalOffset", inherits: true);
public static void SetPopupVerticalOffset(AvaloniaObject element, double value) =>
element.SetValue(PopupVerticalOffsetProperty, value);
@@ -14,7 +14,7 @@ public class MenuAttach
element.GetValue(PopupVerticalOffsetProperty);
public static readonly AttachedProperty<double> PopupHorizontalOffsetProperty =
AvaloniaProperty.RegisterAttached<MenuAttach, AvaloniaObject, double>("PopupHorizontalOffset");
AvaloniaProperty.RegisterAttached<MenuAttach, AvaloniaObject, double>("PopupHorizontalOffset", inherits: true);
public static void SetPopupHorizontalOffset(AvaloniaObject element, double value) =>
element.SetValue(PopupHorizontalOffsetProperty, value);
@@ -23,10 +23,18 @@ public class MenuAttach
element.GetValue(PopupHorizontalOffsetProperty);
public static readonly AttachedProperty<Thickness> ItemPaddingProperty =
AvaloniaProperty.RegisterAttached<MenuAttach, AvaloniaObject, Thickness>("ItemPadding");
AvaloniaProperty.RegisterAttached<MenuAttach, AvaloniaObject, Thickness>("ItemPadding", inherits: true);
public static void SetItemPadding(AvaloniaObject element, Thickness value) =>
element.SetValue(ItemPaddingProperty, value);
public static Thickness GetItemPadding(AvaloniaObject element) => element.GetValue(ItemPaddingProperty);
public static readonly AttachedProperty<double> ItemMinHeightProperty =
AvaloniaProperty.RegisterAttached<MenuAttach, AvaloniaObject, double>("ItemMinHeight", inherits: true);
public static void SetItemMinHeight(AvaloniaObject element, double value) =>
element.SetValue(ItemMinHeightProperty, value);
public static double GetItemMinHeight(AvaloniaObject element) => element.GetValue(ItemMinHeightProperty);
}
@@ -6,10 +6,12 @@
TargetType="ContextMenu">
<Setter Property="hc:MenuAttach.ItemPadding"
Value="{StaticResource DefaultControlPadding}" />
<Setter Property="hc:MenuAttach.ItemMinHeight"
Value="{StaticResource DefaultControlHeight}" />
<Setter Property="hc:MenuAttach.PopupVerticalOffset"
Value="-9" />
Value="-16" />
<Setter Property="hc:MenuAttach.PopupHorizontalOffset"
Value="10" />
Value="1" />
<Setter Property="Background"
Value="{DynamicResource RegionBrush}" />
<Setter Property="hc:BorderElement.CornerRadius"
@@ -18,6 +20,8 @@
Value="{Binding $self.(hc:BorderElement.CornerRadius)}" />
<Setter Property="Padding"
Value="2,2,2,0" />
<Setter Property="BorderThickness"
Value="1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ContextMenu">
@@ -26,7 +30,7 @@
Background="{TemplateBinding Background}"
CornerRadius="{TemplateBinding CornerRadius}"
MaxHeight="{TemplateBinding MaxHeight}"
BorderThickness="1"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{DynamicResource BorderBrush}">
<ScrollViewer Theme="{StaticResource ScrollViewerUpDown}"
Margin="{TemplateBinding Padding}">
@@ -49,10 +53,12 @@
TargetType="ContextMenu">
<Setter Property="hc:MenuAttach.ItemPadding"
Value="6,0" />
<Setter Property="hc:MenuAttach.ItemMinHeight"
Value="20" />
<Setter Property="hc:MenuAttach.PopupVerticalOffset"
Value="-3" />
Value="-11" />
<Setter Property="hc:MenuAttach.PopupHorizontalOffset"
Value="6" />
Value="-2" />
</ControlTheme>
</ResourceDictionary>
@@ -6,7 +6,9 @@
<ControlTheme x:Key="MenuItemBaseStyle"
TargetType="MenuItem">
<Setter Property="Padding"
Value="{Binding Path=(hc:MenuAttach.ItemPadding),RelativeSource={RelativeSource AncestorType=MenuBase}}" />
Value="{Binding $self.(hc:MenuAttach.ItemPadding)}" />
<Setter Property="MinHeight"
Value="{Binding $self.(hc:MenuAttach.ItemMinHeight)}" />
<Setter Property="Background"
Value="Transparent" />
<Setter Property="BorderThickness"
@@ -38,20 +40,19 @@
<ContentControl Grid.Column="0"
x:Name="PART_ToggleIconPresenter"
IsVisible="False"
Margin="3"
Width="16"
Height="16" />
Height="16"
HorizontalAlignment="Right"
VerticalAlignment="Center" />
<ContentControl Grid.Column="0"
Name="PART_IconPresenter"
Width="16"
Height="16"
Margin="3"
HorizontalAlignment="Center"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Content="{TemplateBinding Icon}" />
<ContentPresenter Name="PART_HeaderPresenter"
Grid.Column="1"
Margin="{TemplateBinding Padding}"
VerticalAlignment="Center"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}">
@@ -64,10 +65,11 @@
<TextBlock x:Name="PART_InputGestureText"
Grid.Column="3"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Text="{TemplateBinding InputGesture, Converter={StaticResource PlatformKeyGestureConverter}}" />
<Path Name="rightArrow"
Grid.Column="4"
Margin="10,0,0,0"
Margin="0,0,10,0"
Width="10"
Height="10"
HorizontalAlignment="Left"
@@ -79,10 +81,14 @@
Name="PART_Popup"
IsLightDismissEnabled="False"
IsOpen="{TemplateBinding IsSubMenuOpen, Mode=TwoWay}"
Placement="RightEdgeAlignedTop">
Placement="RightEdgeAlignedTop"
VerticalOffset="{Binding $self.(hc:MenuAttach.PopupVerticalOffset)}"
HorizontalOffset="{Binding $self.(hc:MenuAttach.PopupHorizontalOffset)}">
<Border Background="{DynamicResource RegionBrush}"
BorderBrush="{DynamicResource BorderBrush}"
BorderThickness="1"
Margin="8"
Effect="{StaticResource EffectShadow2}"
CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
<ScrollViewer Theme="{StaticResource ScrollViewerUpDown}"
Margin="2,2,2,0">
@@ -112,10 +118,12 @@
TargetType="Menu">
<Setter Property="hc:MenuAttach.ItemPadding"
Value="{StaticResource DefaultControlPadding}" />
<Setter Property="hc:MenuAttach.ItemMinHeight"
Value="{StaticResource DefaultControlHeight}" />
<Setter Property="hc:MenuAttach.PopupVerticalOffset"
Value="-9" />
Value="-16" />
<Setter Property="hc:MenuAttach.PopupHorizontalOffset"
Value="10" />
Value="1" />
<Setter Property="Background"
Value="{DynamicResource RegionBrush}" />
<Setter Property="Foreground"
@@ -152,10 +160,12 @@
TargetType="Menu">
<Setter Property="hc:MenuAttach.ItemPadding"
Value="6,0" />
<Setter Property="hc:MenuAttach.ItemMinHeight"
Value="20" />
<Setter Property="hc:MenuAttach.PopupVerticalOffset"
Value="-3" />
Value="-11" />
<Setter Property="hc:MenuAttach.PopupHorizontalOffset"
Value="6" />
Value="-2" />
</ControlTheme>
</ResourceDictionary>
@@ -6330,6 +6330,8 @@
</Style>
<Style x:Key="MenuItemBaseStyle" TargetType="MenuItem">
<Setter Property="Padding" Value="{Binding Path=(hc:MenuAttach.ItemPadding),RelativeSource={RelativeSource AncestorType=MenuBase}}" />
<Setter Property="MinHeight" Value="{Binding Path=(hc:MenuAttach.ItemMinHeight),RelativeSource={RelativeSource AncestorType=MenuBase}}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
@@ -6341,7 +6343,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="MenuItem">
<Border x:Name="Bd" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" MinWidth="240" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Border x:Name="templateRoot" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" MinWidth="240" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Grid x:Name="Grid" Margin="{TemplateBinding Padding}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="26" />
@@ -6351,10 +6353,10 @@
<ColumnDefinition Width="20" />
</Grid.ColumnDefinitions>
<ContentPresenter Margin="0,0,10,0" x:Name="Icon" ContentSource="Icon" HorizontalAlignment="Right" Height="16" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" Width="16" />
<Border Margin="0,0,10,0" IsHitTestVisible="False" Grid.Column="0" x:Name="GlyphPanel" CornerRadius="2" Background="{DynamicResource PrimaryBrush}" ClipToBounds="False" HorizontalAlignment="Right" Height="16" Visibility="Hidden" VerticalAlignment="Center" Width="16">
<Border Margin="0,0,10,0" IsHitTestVisible="False" Grid.Column="0" x:Name="GlyphPanel" CornerRadius="2" Background="Red" ClipToBounds="False" HorizontalAlignment="Right" Height="16" Visibility="Hidden" VerticalAlignment="Center" Width="16">
<Path UseLayoutRounding="True" Width="12" Height="12" Data="{StaticResource CheckedGeometry}" StrokeThickness="2" Stretch="Uniform" Stroke="{DynamicResource TextIconBrush}" />
</Border>
<ContentPresenter Grid.Column="1" x:Name="ContentPresenter" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentSource="Header" Margin="0,3" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<ContentPresenter Grid.Column="1" x:Name="ContentPresenter" VerticalAlignment="Center" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<TextBlock x:Name="InputGestureText" Margin="0,0,10,0" Grid.Column="3" VerticalAlignment="Center" HorizontalAlignment="Left" Text="{TemplateBinding InputGestureText}" />
</Grid>
</Border>
@@ -6376,7 +6378,7 @@
<Setter.Value>
<ControlTemplate TargetType="MenuItem">
<Border MinWidth="44" x:Name="templateRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,1,0" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Grid VerticalAlignment="Center" Margin="{TemplateBinding Padding}">
<Grid Margin="{TemplateBinding Padding}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
@@ -6385,7 +6387,7 @@
<Border Margin="0,0,10,0" Grid.Column="0" x:Name="GlyphPanel" CornerRadius="2" Background="{DynamicResource PrimaryBrush}" ClipToBounds="False" HorizontalAlignment="Right" Height="16" Visibility="Collapsed" VerticalAlignment="Center" Width="16">
<Path UseLayoutRounding="True" Width="12" Height="12" Data="{StaticResource CheckedGeometry}" StrokeThickness="2" Stretch="Uniform" Stroke="{DynamicResource TextIconBrush}" />
</Border>
<ContentPresenter x:Name="menuHeaderContainer" ContentTemplate="{TemplateBinding HeaderTemplate}" Grid.Column="1" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<ContentPresenter x:Name="menuHeaderContainer" VerticalAlignment="Center" ContentTemplate="{TemplateBinding HeaderTemplate}" Grid.Column="1" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<Popup Grid.Column="0" x:Name="PART_Popup" PlacementTarget="{Binding ElementName=templateRoot}" AllowsTransparency="True" Focusable="False" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom">
<hc:SimplePanel Effect="{StaticResource EffectShadow2}" Margin="8,0,8,8">
<Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource CornerRadiusSplitConverter},ConverterParameter='0,0,1,1'}" x:Name="SubMenuBorder" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource RegionBrush}">
@@ -6473,7 +6475,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="MenuItem">
<Border x:Name="Bd" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" MinWidth="240" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Border x:Name="templateRoot" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" MinWidth="240" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Grid x:Name="Grid" Margin="{TemplateBinding Padding}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="26" />
@@ -6486,7 +6488,7 @@
<Border Margin="0,0,10,0" IsHitTestVisible="False" Grid.Column="0" x:Name="GlyphPanel" CornerRadius="2" Background="{DynamicResource PrimaryBrush}" ClipToBounds="False" HorizontalAlignment="Right" Height="16" Visibility="Hidden" VerticalAlignment="Center" Width="16">
<Path UseLayoutRounding="True" Width="12" Height="12" Data="{StaticResource CheckedGeometry}" StrokeThickness="2" Stretch="Uniform" Stroke="{DynamicResource TextIconBrush}" />
</Border>
<ContentPresenter TextElement.Foreground="{TemplateBinding Foreground}" Margin="0,3" x:Name="ContentPresenter" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentTemplate="{TemplateBinding HeaderTemplate}" Grid.Column="1" ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<ContentPresenter TextElement.Foreground="{TemplateBinding Foreground}" x:Name="ContentPresenter" ContentStringFormat="{TemplateBinding HeaderStringFormat}" VerticalAlignment="Center" ContentTemplate="{TemplateBinding HeaderTemplate}" Grid.Column="1" ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<Path x:Name="Path" Grid.Column="4" Width="10" Height="10" HorizontalAlignment="Left" Data="{StaticResource RightGeometry}" Stretch="Uniform" Fill="{TemplateBinding Foreground}" VerticalAlignment="Center" />
<Popup Grid.Column="1" x:Name="PART_Popup" AllowsTransparency="True" Focusable="False" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Right" VerticalOffset="{Binding Path=(hc:MenuAttach.PopupVerticalOffset),RelativeSource={RelativeSource AncestorType=MenuBase}}" HorizontalOffset="{Binding Path=(hc:MenuAttach.PopupHorizontalOffset),RelativeSource={RelativeSource AncestorType=MenuBase}}">
<Border Effect="{StaticResource EffectShadow2}" Margin="8" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="SubMenuBorder" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource RegionBrush}">
@@ -6516,6 +6518,7 @@
</Style>
<Style x:Key="MenuBaseStyle" TargetType="Menu">
<Setter Property="hc:MenuAttach.ItemPadding" Value="{StaticResource DefaultControlPadding}" />
<Setter Property="hc:MenuAttach.ItemMinHeight" Value="{StaticResource DefaultControlHeight}" />
<Setter Property="hc:MenuAttach.PopupVerticalOffset" Value="-9" />
<Setter Property="hc:MenuAttach.PopupHorizontalOffset" Value="10" />
<Setter Property="OverridesDefaultStyle" Value="True" />
@@ -7025,6 +7028,7 @@
<Style BasedOn="{StaticResource MenuBaseStyle}" TargetType="Menu" />
<Style x:Key="Menu.Small" BasedOn="{StaticResource MenuBaseStyle}" TargetType="Menu">
<Setter Property="hc:MenuAttach.ItemPadding" Value="6,0" />
<Setter Property="hc:MenuAttach.ItemMinHeight" Value="{StaticResource DefaultControlHeight}" />
<Setter Property="hc:MenuAttach.PopupVerticalOffset" Value="-3" />
<Setter Property="hc:MenuAttach.PopupHorizontalOffset" Value="6" />
</Style>
@@ -7943,16 +7947,18 @@
</Style>
<Style x:Key="ContextMenuBaseStyle" TargetType="ContextMenu">
<Setter Property="hc:MenuAttach.ItemPadding" Value="{StaticResource DefaultControlPadding}" />
<Setter Property="hc:MenuAttach.PopupVerticalOffset" Value="-9" />
<Setter Property="hc:MenuAttach.ItemMinHeight" Value="{StaticResource DefaultControlHeight}" />
<Setter Property="hc:MenuAttach.PopupVerticalOffset" Value="-8" />
<Setter Property="hc:MenuAttach.PopupHorizontalOffset" Value="10" />
<Setter Property="Background" Value="{DynamicResource RegionBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}" />
<Setter Property="Padding" Value="2,2,2,0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ContextMenu">
<Border Effect="{StaticResource EffectShadow2}" Margin="8" Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" MaxHeight="{TemplateBinding MaxHeight}" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}">
<Border Effect="{StaticResource EffectShadow2}" Margin="8" Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" MaxHeight="{TemplateBinding MaxHeight}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{DynamicResource BorderBrush}">
<ScrollViewer Style="{StaticResource ScrollViewerUpDown}" Margin="{TemplateBinding Padding}">
<ItemsPresenter />
</ScrollViewer>
@@ -12442,6 +12448,7 @@
<Style BasedOn="{StaticResource ContextMenuBaseStyle}" TargetType="ContextMenu" />
<Style x:Key="ContextMenu.Small" BasedOn="{StaticResource ContextMenuBaseStyle}" TargetType="ContextMenu">
<Setter Property="hc:MenuAttach.ItemPadding" Value="6,0" />
<Setter Property="hc:MenuAttach.ItemMinHeight" Value="20" />
<Setter Property="hc:MenuAttach.PopupVerticalOffset" Value="-3" />
<Setter Property="hc:MenuAttach.PopupHorizontalOffset" Value="6" />
</Style>
@@ -6,7 +6,8 @@ namespace HandyControl.Controls;
public class MenuAttach
{
public static readonly DependencyProperty PopupVerticalOffsetProperty = DependencyProperty.RegisterAttached(
"PopupVerticalOffset", typeof(double), typeof(MenuAttach), new PropertyMetadata(ValueBoxes.Double0Box));
"PopupVerticalOffset", typeof(double), typeof(MenuAttach),
new FrameworkPropertyMetadata(ValueBoxes.Double0Box, FrameworkPropertyMetadataOptions.Inherits));
public static void SetPopupVerticalOffset(DependencyObject element, double value)
=> element.SetValue(PopupVerticalOffsetProperty, value);
@@ -15,7 +16,8 @@ public class MenuAttach
=> (double) element.GetValue(PopupVerticalOffsetProperty);
public static readonly DependencyProperty PopupHorizontalOffsetProperty = DependencyProperty.RegisterAttached(
"PopupHorizontalOffset", typeof(double), typeof(MenuAttach), new PropertyMetadata(ValueBoxes.Double0Box));
"PopupHorizontalOffset", typeof(double), typeof(MenuAttach),
new FrameworkPropertyMetadata(ValueBoxes.Double0Box, FrameworkPropertyMetadataOptions.Inherits));
public static void SetPopupHorizontalOffset(DependencyObject element, double value)
=> element.SetValue(PopupHorizontalOffsetProperty, value);
@@ -24,11 +26,22 @@ public class MenuAttach
=> (double) element.GetValue(PopupHorizontalOffsetProperty);
public static readonly DependencyProperty ItemPaddingProperty = DependencyProperty.RegisterAttached(
"ItemPadding", typeof(Thickness), typeof(MenuAttach), new PropertyMetadata(default(Thickness)));
"ItemPadding", typeof(Thickness), typeof(MenuAttach),
new FrameworkPropertyMetadata(default(Thickness), FrameworkPropertyMetadataOptions.Inherits));
public static void SetItemPadding(DependencyObject element, Thickness value)
=> element.SetValue(ItemPaddingProperty, value);
public static Thickness GetItemPadding(DependencyObject element)
=> (Thickness) element.GetValue(ItemPaddingProperty);
public static readonly DependencyProperty ItemMinHeightProperty = DependencyProperty.RegisterAttached(
"ItemMinHeight", typeof(double), typeof(MenuAttach),
new FrameworkPropertyMetadata(ValueBoxes.Double0Box, FrameworkPropertyMetadataOptions.Inherits));
public static void SetItemMinHeight(DependencyObject element, double value)
=> element.SetValue(ItemMinHeightProperty, value);
public static double GetItemMinHeight(DependencyObject element)
=> (double) element.GetValue(ItemMinHeightProperty);
}
@@ -3,16 +3,18 @@
<Style x:Key="ContextMenuBaseStyle" TargetType="ContextMenu">
<Setter Property="hc:MenuAttach.ItemPadding" Value="{StaticResource DefaultControlPadding}" />
<Setter Property="hc:MenuAttach.PopupVerticalOffset" Value="-9" />
<Setter Property="hc:MenuAttach.ItemMinHeight" Value="{StaticResource DefaultControlHeight}" />
<Setter Property="hc:MenuAttach.PopupVerticalOffset" Value="-8" />
<Setter Property="hc:MenuAttach.PopupHorizontalOffset" Value="10" />
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}" />
<Setter Property="Padding" Value="2,2,2,0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ContextMenu">
<Border Effect="{StaticResource EffectShadow2}" Margin="8" Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" MaxHeight="{TemplateBinding MaxHeight}" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}">
<Border Effect="{StaticResource EffectShadow2}" Margin="8" Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" MaxHeight="{TemplateBinding MaxHeight}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{DynamicResource BorderBrush}">
<ScrollViewer Style="{StaticResource ScrollViewerUpDown}" Margin="{TemplateBinding Padding}">
<ItemsPresenter/>
</ScrollViewer>
@@ -1,9 +1,11 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:hc="clr-namespace:HandyControl.Controls">
<Style x:Key="MenuItemBaseStyle" TargetType="MenuItem">
<Setter Property="Padding" Value="{Binding Path=(hc:MenuAttach.ItemPadding),RelativeSource={RelativeSource AncestorType=MenuBase}}"/>
<Setter Property="MinHeight" Value="{Binding Path=(hc:MenuAttach.ItemMinHeight),RelativeSource={RelativeSource AncestorType=MenuBase}}"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
@@ -15,7 +17,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="MenuItem">
<Border x:Name="Bd" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" MinWidth="240" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Border x:Name="templateRoot" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" MinWidth="240" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Grid x:Name="Grid" Margin="{TemplateBinding Padding}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="26"/>
@@ -25,10 +27,10 @@
<ColumnDefinition Width="20"/>
</Grid.ColumnDefinitions>
<ContentPresenter Margin="0,0,10,0" x:Name="Icon" ContentSource="Icon" HorizontalAlignment="Right" Height="16" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" Width="16"/>
<Border Margin="0,0,10,0" IsHitTestVisible="False" Grid.Column="0" x:Name="GlyphPanel" CornerRadius="2" Background="{DynamicResource PrimaryBrush}" ClipToBounds="False" HorizontalAlignment="Right" Height="16" Visibility="Hidden" VerticalAlignment="Center" Width="16">
<Border Margin="0,0,10,0" IsHitTestVisible="False" Grid.Column="0" x:Name="GlyphPanel" CornerRadius="2" Background="Red" ClipToBounds="False" HorizontalAlignment="Right" Height="16" Visibility="Hidden" VerticalAlignment="Center" Width="16">
<Path UseLayoutRounding="True" Width="12" Height="12" Data="{StaticResource CheckedGeometry}" StrokeThickness="2" Stretch="Uniform" Stroke="{DynamicResource TextIconBrush}"/>
</Border>
<ContentPresenter Grid.Column="1" x:Name="ContentPresenter" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentSource="Header" Margin="0,3" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
<ContentPresenter Grid.Column="1" x:Name="ContentPresenter" VerticalAlignment="Center" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
<TextBlock x:Name="InputGestureText" Margin="0,0,10,0" Grid.Column="3" VerticalAlignment="Center" HorizontalAlignment="Left" Text="{TemplateBinding InputGestureText}"/>
</Grid>
</Border>
@@ -50,7 +52,7 @@
<Setter.Value>
<ControlTemplate TargetType="MenuItem">
<Border MinWidth="44" x:Name="templateRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,1,0" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Grid VerticalAlignment="Center" Margin="{TemplateBinding Padding}">
<Grid Margin="{TemplateBinding Padding}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
@@ -59,7 +61,7 @@
<Border Margin="0,0,10,0" Grid.Column="0" x:Name="GlyphPanel" CornerRadius="2" Background="{DynamicResource PrimaryBrush}" ClipToBounds="False" HorizontalAlignment="Right" Height="16" Visibility="Collapsed" VerticalAlignment="Center" Width="16">
<Path UseLayoutRounding="True" Width="12" Height="12" Data="{StaticResource CheckedGeometry}" StrokeThickness="2" Stretch="Uniform" Stroke="{DynamicResource TextIconBrush}"/>
</Border>
<ContentPresenter x:Name="menuHeaderContainer" ContentTemplate="{TemplateBinding HeaderTemplate}" Grid.Column="1" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
<ContentPresenter x:Name="menuHeaderContainer" VerticalAlignment="Center" ContentTemplate="{TemplateBinding HeaderTemplate}" Grid.Column="1" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
<Popup Grid.Column="0" x:Name="PART_Popup" PlacementTarget="{Binding ElementName=templateRoot}" AllowsTransparency="True" Focusable="False" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom">
<hc:SimplePanel Effect="{StaticResource EffectShadow2}" Margin="8,0,8,8">
<Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource CornerRadiusSplitConverter},ConverterParameter='0,0,1,1'}" x:Name="SubMenuBorder" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource RegionBrush}">
@@ -147,7 +149,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="MenuItem">
<Border x:Name="Bd" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" MinWidth="240" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Border x:Name="templateRoot" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" MinWidth="240" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Grid x:Name="Grid" Margin="{TemplateBinding Padding}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="26"/>
@@ -160,7 +162,7 @@
<Border Margin="0,0,10,0" IsHitTestVisible="False" Grid.Column="0" x:Name="GlyphPanel" CornerRadius="2" Background="{DynamicResource PrimaryBrush}" ClipToBounds="False" HorizontalAlignment="Right" Height="16" Visibility="Hidden" VerticalAlignment="Center" Width="16">
<Path UseLayoutRounding="True" Width="12" Height="12" Data="{StaticResource CheckedGeometry}" StrokeThickness="2" Stretch="Uniform" Stroke="{DynamicResource TextIconBrush}"/>
</Border>
<ContentPresenter TextElement.Foreground="{TemplateBinding Foreground}" Margin="0,3" x:Name="ContentPresenter" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentTemplate="{TemplateBinding HeaderTemplate}" Grid.Column="1" ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
<ContentPresenter TextElement.Foreground="{TemplateBinding Foreground}" x:Name="ContentPresenter" ContentStringFormat="{TemplateBinding HeaderStringFormat}" VerticalAlignment="Center" ContentTemplate="{TemplateBinding HeaderTemplate}" Grid.Column="1" ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
<Path x:Name="Path" Grid.Column="4" Width="10" Height="10" HorizontalAlignment="Left" Data="{StaticResource RightGeometry}" Stretch="Uniform" Fill="{TemplateBinding Foreground}" VerticalAlignment="Center"/>
<Popup Grid.Column="1" x:Name="PART_Popup" AllowsTransparency="True" Focusable="False" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Right" VerticalOffset="{Binding Path=(hc:MenuAttach.PopupVerticalOffset),RelativeSource={RelativeSource AncestorType=MenuBase}}" HorizontalOffset="{Binding Path=(hc:MenuAttach.PopupHorizontalOffset),RelativeSource={RelativeSource AncestorType=MenuBase}}">
<Border Effect="{StaticResource EffectShadow2}" Margin="8" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="SubMenuBorder" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource RegionBrush}">
@@ -191,6 +193,7 @@
<Style x:Key="MenuBaseStyle" TargetType="Menu">
<Setter Property="hc:MenuAttach.ItemPadding" Value="{StaticResource DefaultControlPadding}" />
<Setter Property="hc:MenuAttach.ItemMinHeight" Value="{StaticResource DefaultControlHeight}" />
<Setter Property="hc:MenuAttach.PopupVerticalOffset" Value="-9" />
<Setter Property="hc:MenuAttach.PopupHorizontalOffset" Value="10" />
<Setter Property="OverridesDefaultStyle" Value="True" />
@@ -5,6 +5,7 @@
<Style x:Key="ContextMenu.Small" BasedOn="{StaticResource ContextMenuBaseStyle}" TargetType="ContextMenu">
<Setter Property="hc:MenuAttach.ItemPadding" Value="6,0" />
<Setter Property="hc:MenuAttach.ItemMinHeight" Value="20" />
<Setter Property="hc:MenuAttach.PopupVerticalOffset" Value="-3" />
<Setter Property="hc:MenuAttach.PopupHorizontalOffset" Value="6" />
</Style>
@@ -7,6 +7,7 @@
<Style x:Key="Menu.Small" BasedOn="{StaticResource MenuBaseStyle}" TargetType="Menu">
<Setter Property="hc:MenuAttach.ItemPadding" Value="6,0" />
<Setter Property="hc:MenuAttach.ItemMinHeight" Value="{StaticResource DefaultControlHeight}" />
<Setter Property="hc:MenuAttach.PopupVerticalOffset" Value="-3" />
<Setter Property="hc:MenuAttach.PopupHorizontalOffset" Value="6" />
</Style>
@@ -6414,6 +6414,8 @@
</Style>
<Style x:Key="MenuItemBaseStyle" TargetType="MenuItem">
<Setter Property="Padding" Value="{Binding Path=(hc:MenuAttach.ItemPadding),RelativeSource={RelativeSource AncestorType=MenuBase}}" />
<Setter Property="MinHeight" Value="{Binding Path=(hc:MenuAttach.ItemMinHeight),RelativeSource={RelativeSource AncestorType=MenuBase}}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
@@ -6425,7 +6427,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="MenuItem">
<Border x:Name="Bd" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" MinWidth="240" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Border x:Name="templateRoot" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" MinWidth="240" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Grid x:Name="Grid" Margin="{TemplateBinding Padding}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="26" />
@@ -6435,10 +6437,10 @@
<ColumnDefinition Width="20" />
</Grid.ColumnDefinitions>
<ContentPresenter Margin="0,0,10,0" x:Name="Icon" ContentSource="Icon" HorizontalAlignment="Right" Height="16" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center" Width="16" />
<Border Margin="0,0,10,0" IsHitTestVisible="False" Grid.Column="0" x:Name="GlyphPanel" CornerRadius="2" Background="{DynamicResource PrimaryBrush}" ClipToBounds="False" HorizontalAlignment="Right" Height="16" Visibility="Hidden" VerticalAlignment="Center" Width="16">
<Border Margin="0,0,10,0" IsHitTestVisible="False" Grid.Column="0" x:Name="GlyphPanel" CornerRadius="2" Background="Red" ClipToBounds="False" HorizontalAlignment="Right" Height="16" Visibility="Hidden" VerticalAlignment="Center" Width="16">
<Path UseLayoutRounding="True" Width="12" Height="12" Data="{StaticResource CheckedGeometry}" StrokeThickness="2" Stretch="Uniform" Stroke="{DynamicResource TextIconBrush}" />
</Border>
<ContentPresenter Grid.Column="1" x:Name="ContentPresenter" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentSource="Header" Margin="0,3" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<ContentPresenter Grid.Column="1" x:Name="ContentPresenter" VerticalAlignment="Center" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<TextBlock x:Name="InputGestureText" Margin="0,0,10,0" Grid.Column="3" VerticalAlignment="Center" HorizontalAlignment="Left" Text="{TemplateBinding InputGestureText}" />
</Grid>
</Border>
@@ -6460,7 +6462,7 @@
<Setter.Value>
<ControlTemplate TargetType="MenuItem">
<Border MinWidth="44" x:Name="templateRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1,1,1,0" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Grid VerticalAlignment="Center" Margin="{TemplateBinding Padding}">
<Grid Margin="{TemplateBinding Padding}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
@@ -6469,7 +6471,7 @@
<Border Margin="0,0,10,0" Grid.Column="0" x:Name="GlyphPanel" CornerRadius="2" Background="{DynamicResource PrimaryBrush}" ClipToBounds="False" HorizontalAlignment="Right" Height="16" Visibility="Collapsed" VerticalAlignment="Center" Width="16">
<Path UseLayoutRounding="True" Width="12" Height="12" Data="{StaticResource CheckedGeometry}" StrokeThickness="2" Stretch="Uniform" Stroke="{DynamicResource TextIconBrush}" />
</Border>
<ContentPresenter x:Name="menuHeaderContainer" ContentTemplate="{TemplateBinding HeaderTemplate}" Grid.Column="1" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<ContentPresenter x:Name="menuHeaderContainer" VerticalAlignment="Center" ContentTemplate="{TemplateBinding HeaderTemplate}" Grid.Column="1" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<Popup Grid.Column="0" x:Name="PART_Popup" PlacementTarget="{Binding ElementName=templateRoot}" AllowsTransparency="True" Focusable="False" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom">
<hc:SimplePanel Effect="{StaticResource EffectShadow2}" Margin="8,0,8,8">
<Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource CornerRadiusSplitConverter},ConverterParameter='0,0,1,1'}" x:Name="SubMenuBorder" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource RegionBrush}">
@@ -6557,7 +6559,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="MenuItem">
<Border x:Name="Bd" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" MinWidth="240" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Border x:Name="templateRoot" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" MinWidth="240" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
<Grid x:Name="Grid" Margin="{TemplateBinding Padding}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="26" />
@@ -6570,7 +6572,7 @@
<Border Margin="0,0,10,0" IsHitTestVisible="False" Grid.Column="0" x:Name="GlyphPanel" CornerRadius="2" Background="{DynamicResource PrimaryBrush}" ClipToBounds="False" HorizontalAlignment="Right" Height="16" Visibility="Hidden" VerticalAlignment="Center" Width="16">
<Path UseLayoutRounding="True" Width="12" Height="12" Data="{StaticResource CheckedGeometry}" StrokeThickness="2" Stretch="Uniform" Stroke="{DynamicResource TextIconBrush}" />
</Border>
<ContentPresenter TextElement.Foreground="{TemplateBinding Foreground}" Margin="0,3" x:Name="ContentPresenter" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentTemplate="{TemplateBinding HeaderTemplate}" Grid.Column="1" ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<ContentPresenter TextElement.Foreground="{TemplateBinding Foreground}" x:Name="ContentPresenter" ContentStringFormat="{TemplateBinding HeaderStringFormat}" VerticalAlignment="Center" ContentTemplate="{TemplateBinding HeaderTemplate}" Grid.Column="1" ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<Path x:Name="Path" Grid.Column="4" Width="10" Height="10" HorizontalAlignment="Left" Data="{StaticResource RightGeometry}" Stretch="Uniform" Fill="{TemplateBinding Foreground}" VerticalAlignment="Center" />
<Popup Grid.Column="1" x:Name="PART_Popup" AllowsTransparency="True" Focusable="False" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Right" VerticalOffset="{Binding Path=(hc:MenuAttach.PopupVerticalOffset),RelativeSource={RelativeSource AncestorType=MenuBase}}" HorizontalOffset="{Binding Path=(hc:MenuAttach.PopupHorizontalOffset),RelativeSource={RelativeSource AncestorType=MenuBase}}">
<Border Effect="{StaticResource EffectShadow2}" Margin="8" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="SubMenuBorder" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource RegionBrush}">
@@ -6600,6 +6602,7 @@
</Style>
<Style x:Key="MenuBaseStyle" TargetType="Menu">
<Setter Property="hc:MenuAttach.ItemPadding" Value="{StaticResource DefaultControlPadding}" />
<Setter Property="hc:MenuAttach.ItemMinHeight" Value="{StaticResource DefaultControlHeight}" />
<Setter Property="hc:MenuAttach.PopupVerticalOffset" Value="-9" />
<Setter Property="hc:MenuAttach.PopupHorizontalOffset" Value="10" />
<Setter Property="OverridesDefaultStyle" Value="True" />
@@ -7109,6 +7112,7 @@
<Style BasedOn="{StaticResource MenuBaseStyle}" TargetType="Menu" />
<Style x:Key="Menu.Small" BasedOn="{StaticResource MenuBaseStyle}" TargetType="Menu">
<Setter Property="hc:MenuAttach.ItemPadding" Value="6,0" />
<Setter Property="hc:MenuAttach.ItemMinHeight" Value="{StaticResource DefaultControlHeight}" />
<Setter Property="hc:MenuAttach.PopupVerticalOffset" Value="-3" />
<Setter Property="hc:MenuAttach.PopupHorizontalOffset" Value="6" />
</Style>
@@ -8062,16 +8066,18 @@
</Style>
<Style x:Key="ContextMenuBaseStyle" TargetType="ContextMenu">
<Setter Property="hc:MenuAttach.ItemPadding" Value="{StaticResource DefaultControlPadding}" />
<Setter Property="hc:MenuAttach.PopupVerticalOffset" Value="-9" />
<Setter Property="hc:MenuAttach.ItemMinHeight" Value="{StaticResource DefaultControlHeight}" />
<Setter Property="hc:MenuAttach.PopupVerticalOffset" Value="-8" />
<Setter Property="hc:MenuAttach.PopupHorizontalOffset" Value="10" />
<Setter Property="Background" Value="{DynamicResource RegionBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}" />
<Setter Property="Padding" Value="2,2,2,0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ContextMenu">
<Border Effect="{StaticResource EffectShadow2}" Margin="8" Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" MaxHeight="{TemplateBinding MaxHeight}" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}">
<Border Effect="{StaticResource EffectShadow2}" Margin="8" Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" MaxHeight="{TemplateBinding MaxHeight}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{DynamicResource BorderBrush}">
<ScrollViewer Style="{StaticResource ScrollViewerUpDown}" Margin="{TemplateBinding Padding}">
<ItemsPresenter />
</ScrollViewer>
@@ -12578,6 +12584,7 @@
<Style BasedOn="{StaticResource ContextMenuBaseStyle}" TargetType="ContextMenu" />
<Style x:Key="ContextMenu.Small" BasedOn="{StaticResource ContextMenuBaseStyle}" TargetType="ContextMenu">
<Setter Property="hc:MenuAttach.ItemPadding" Value="6,0" />
<Setter Property="hc:MenuAttach.ItemMinHeight" Value="20" />
<Setter Property="hc:MenuAttach.PopupVerticalOffset" Value="-3" />
<Setter Property="hc:MenuAttach.PopupHorizontalOffset" Value="6" />
</Style>