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

@@ -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);
}