Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't override ContextMenu.Placement when Open called from code. #13967

Merged
merged 1 commit into from Dec 15, 2023

Conversation

grokys
Copy link
Member

@grokys grokys commented Dec 15, 2023

What does the pull request do?

#6059 changed ContextMenu.Open to open the context menu at the bottom of the control when the ContextRequestedEventArgs doesn't contain a position, however it also had the side-effect of preventing the Placement property from being respected when opening a ContextMenu from code.

Change the private Open method to accept a PlacementMode instead of a boolean flag, and only pass Bottom here when ContextRequestedEventArgs has no requested position.

Fixed issues

Fixes #12504

#6059 changed `ContextMenu.Open` to open the context menu at the bottom of the control when the `ContextRequestedEventArgs` doesn't contain a position, however it also had the side-effect of preventing the `Placement` property from being respected when opening a `ContextMenu` from code.

Change the private `Open` method to accept a `PlacementMode` instead of a boolean flag, and only pass `Bottom` here when `ContextRequestedEventArgs` has no requested position.

Fixes #12504
@grokys grokys requested a review from maxkatz6 December 15, 2023 15:53
@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.1.999-cibuild0042954-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@maxkatz6 maxkatz6 added this pull request to the merge queue Dec 15, 2023
Merged via the queue into master with commit 645ca85 Dec 15, 2023
7 checks passed
@maxkatz6 maxkatz6 deleted the fixes/12504-contextmenu-open-pointer branch December 15, 2023 21:10
grokys added a commit that referenced this pull request Dec 15, 2023
#6059 changed `ContextMenu.Open` to open the context menu at the bottom of the control when the `ContextRequestedEventArgs` doesn't contain a position, however it also had the side-effect of preventing the `Placement` property from being respected when opening a `ContextMenu` from code.

Change the private `Open` method to accept a `PlacementMode` instead of a boolean flag, and only pass `Bottom` here when `ContextRequestedEventArgs` has no requested position.

Fixes #12504
@maxkatz6 maxkatz6 added the backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch label Dec 20, 2023
@maxkatz6 maxkatz6 added backported-11.0.x and removed backport-candidate-11.0.x Consider this PR for backporting to 11.0 branch labels Jan 17, 2024
maxkatz6 pushed a commit that referenced this pull request Jan 17, 2024
#6059 changed `ContextMenu.Open` to open the context menu at the bottom of the control when the `ContextRequestedEventArgs` doesn't contain a position, however it also had the side-effect of preventing the `Placement` property from being respected when opening a `ContextMenu` from code.

Change the private `Open` method to accept a `PlacementMode` instead of a boolean flag, and only pass `Bottom` here when `ContextRequestedEventArgs` has no requested position.

Fixes #12504
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ContextMenu can not be opened at pointer position from code-behind
3 participants