From cc7656eecb25204375e971b091fa21cea7da5348 Mon Sep 17 00:00:00 2001 From: robloo Date: Tue, 14 Mar 2023 12:25:36 -0400 Subject: [PATCH] Rename ContextMenu.PlacementMode to ContextMenu.Placement --- src/Avalonia.Controls/ContextMenu.cs | 24 +++++++++---------- .../ContextMenuTests.cs | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Avalonia.Controls/ContextMenu.cs b/src/Avalonia.Controls/ContextMenu.cs index d1af361867..5d964dd172 100644 --- a/src/Avalonia.Controls/ContextMenu.cs +++ b/src/Avalonia.Controls/ContextMenu.cs @@ -55,9 +55,9 @@ namespace Avalonia.Controls Popup.PlacementGravityProperty.AddOwner(); /// - /// Defines the property. + /// Defines the property. /// - public static readonly StyledProperty PlacementModeProperty = + public static readonly StyledProperty PlacementProperty = Popup.PlacementProperty.AddOwner(); /// @@ -108,7 +108,7 @@ namespace Avalonia.Controls static ContextMenu() { ItemsPanelProperty.OverrideDefaultValue(DefaultPanel); - PlacementModeProperty.OverrideDefaultValue(PlacementMode.Pointer); + PlacementProperty.OverrideDefaultValue(PlacementMode.Pointer); ContextMenuProperty.Changed.Subscribe(ContextMenuChanged); AutomationProperties.AccessibilityViewProperty.OverrideDefaultValue(AccessibilityView.Control); AutomationProperties.ControlTypeOverrideProperty.OverrideDefaultValue(AutomationControlType.Menu); @@ -133,7 +133,7 @@ namespace Avalonia.Controls } /// - /// Gets or sets the anchor point on the when + /// Gets or sets the anchor point on the when /// is . /// public PopupAnchor PlacementAnchor @@ -154,7 +154,7 @@ namespace Avalonia.Controls /// /// Gets or sets a value which defines in what direction the context menu should open - /// when is . + /// when is . /// public PopupGravity PlacementGravity { @@ -163,12 +163,12 @@ namespace Avalonia.Controls } /// - /// Gets or sets the placement mode of the context menu in relation to the. + /// Gets or sets the desired placement of the context menu in relation to the. /// - public PlacementMode PlacementMode + public PlacementMode Placement { - get { return GetValue(PlacementModeProperty); } - set { SetValue(PlacementModeProperty, value); } + get { return GetValue(PlacementProperty); } + set { SetValue(PlacementProperty, value); } } public bool WindowManagerAddShadowHint @@ -179,7 +179,7 @@ namespace Avalonia.Controls /// /// Gets or sets the the anchor rectangle within the parent that the context menu will be placed - /// relative to when is . + /// relative to when is . /// /// /// The placement rect defines a rectangle relative to around @@ -343,9 +343,9 @@ namespace Avalonia.Controls ((ISetLogicalParent)_popup).SetParent(control); } - _popup.Placement = !requestedByPointer && PlacementMode == PlacementMode.Pointer + _popup.Placement = !requestedByPointer && Placement == PlacementMode.Pointer ? PlacementMode.Bottom - : PlacementMode; + : Placement; //Position of the line below is really important. //All styles are being applied only when control has logical parent. diff --git a/tests/Avalonia.Controls.UnitTests/ContextMenuTests.cs b/tests/Avalonia.Controls.UnitTests/ContextMenuTests.cs index d99c90cb77..803cc793fd 100644 --- a/tests/Avalonia.Controls.UnitTests/ContextMenuTests.cs +++ b/tests/Avalonia.Controls.UnitTests/ContextMenuTests.cs @@ -303,7 +303,7 @@ namespace Avalonia.Controls.UnitTests window.Show(); var c = new ContextMenu(); - c.PlacementMode = PlacementMode.Bottom; + c.Placement = PlacementMode.Bottom; c.Open(button); var overlay = LightDismissOverlayLayer.GetLightDismissOverlayLayer(window);