-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add CustomPopupPlacementCallback support #15233
Comments
The API is designed to be Wayland-compatible and is designed against To position your popup relative to the top-left corner of a control use OffsetX/OffsetY properties with TopLeft anchor and BottomRight gravity. |
We can, however, introduce a callback that would allow to modify offset/anchor/gravity properties right before the popup is shown |
Just to clarify, the callback in WPF doesn't use screen coordinates. It is all coordinates relative to the target element. So a The WPF callback allows us to look at things like target element size, popup size, and horizontal/vertical offsets, and then return target element-relative placement options. I would think that should be Wayland-compatible since it's not global screen coordinates. The WPF way would not make us alter the actual I admittedly don't know the nuts and bolts of how Avalonia implemented popup positioning very well but when searching around, I happened to see a If you guys are initializing a If we could alter the |
Is your feature request related to a problem? Please describe.
WPF has a CustomPopupPlacementCallback delegate that can be assigned to their Popup and when
Popup.Placement == PlacementMode.Custom
, that delegate is used to supply dynamic options for placement via callback. The options are returned in an array of CustomPopupPlacement objects, and the one that appears first and allows the popup to fit best on screen is the one that is used.We have a requirement where an Avalonia
Control
that has aToolTip
needs to display that tip in a certain location relative to the target control. However, that relative location changes based on the current state of the target control and other controls around it at the time popup shows. Thus, we cannot use the simplePlacement
properties onPopup
and need the use of a dynamic callback like in WPF to allow us to alter things on the fly.Describe the solution you'd like
While we don't necessarily need the API to match WPF's
CustomPopupPlacementCallback
andCustomPopupPlacement
exactly (they are slightly difficult to grasp when first learning them), we do need a callback function that can tell a popup like aToolTip
to display at some location relative to the target control.The Avalonia Popup already has some slight differences and enhancements over WPF popups, so we are happy to have a discussion on API implementation for this callback feature that would fit into the Avalonia model.
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: