Skip to content

Commit

Permalink
Merge pull request #6796 from AvaloniaUI/fixes/6795-contextmenu-place…
Browse files Browse the repository at this point in the history
…ment

Update context menu popup parameters on each show.
  • Loading branch information
danwalmsley committed Oct 26, 2021
1 parent 04fb4c6 commit 015f1ac
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/Avalonia.Controls/ContextMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,16 +329,8 @@ private void Open(Control control, Control placementTarget, bool requestedByPoin
{
_popup = new Popup
{
HorizontalOffset = HorizontalOffset,
VerticalOffset = VerticalOffset,
PlacementAnchor = PlacementAnchor,
PlacementConstraintAdjustment = PlacementConstraintAdjustment,
PlacementGravity = PlacementGravity,
PlacementMode = PlacementMode,
PlacementRect = PlacementRect,
IsLightDismissEnabled = true,
OverlayDismissEventPassThrough = true,
WindowManagerAddShadowHint = WindowManagerAddShadowHint,
};

_popup.Opened += PopupOpened;
Expand All @@ -358,6 +350,13 @@ private void Open(Control control, Control placementTarget, bool requestedByPoin
: PlacementMode;

_popup.PlacementTarget = placementTarget;
_popup.HorizontalOffset = HorizontalOffset;
_popup.VerticalOffset = VerticalOffset;
_popup.PlacementAnchor = PlacementAnchor;
_popup.PlacementConstraintAdjustment = PlacementConstraintAdjustment;
_popup.PlacementGravity = PlacementGravity;
_popup.PlacementRect = PlacementRect;
_popup.WindowManagerAddShadowHint = WindowManagerAddShadowHint;
_popup.Child = this;
IsOpen = true;
_popup.IsOpen = true;
Expand Down

0 comments on commit 015f1ac

Please sign in to comment.