Struct PopupPositionerParameters
- Namespace
- Avalonia.Controls.Primitives.PopupPositioning
- Assembly
- Avalonia.Controls.dll
Provides positioning parameters to IPopupPositioner.
[Unstable("This API may be removed in Avalonia 12. If you depend on this API, please open an issue with details of your use-case.")]
public struct PopupPositionerParameters : IEquatable<PopupPositionerParameters>
- Implements
- Inherited Members
Remarks
The IPopupPositioner provides a collection of rules for the placement of a popup relative to its parent. Rules can be defined to ensure the popup remains within the visible area's borders, and to specify how the popup changes its position, such as sliding along an axis, or flipping around a rectangle. These positioner-created rules are constrained by the requirement that a popup must intersect with or be at least partially adjacent to its parent surface.
Properties
Anchor
Defines the anchor point for the anchor rectangle.
public PopupAnchor Anchor { get; set; }
Property Value
Remarks
The specified anchor is used derive an anchor point that the popup will be positioned relative to. If a corner anchor is set (e.g. 'TopLeft' or 'BottomRight'), the anchor point will be at the specified corner; otherwise, the derived anchor point will be centered on the specified edge, or in the center of the anchor rectangle if no edge is specified.
AnchorRectangle
Specifies the anchor rectangle within the parent that the popup will be placed relative to, in device-independent pixels.
public Rect AnchorRectangle { readonly get; set; }
Property Value
Remarks
The rectangle is relative to the parent geometry and may not extend outside the window geometry of the popup's parent.
ConstraintAdjustment
Specify how the popup should be positioned if the originally intended position caused the popup to be constrained.
public PopupPositionerConstraintAdjustment ConstraintAdjustment { readonly get; set; }
Property Value
Remarks
Adjusts the popup position if the intended position caused the popup to be constrained; meaning at least partially outside positioning boundaries set by the positioner. The adjustment is set by constructing a bitmask describing the adjustment to be made when the popup is constrained on that axis.
If no bit for one axis is set, the positioner will assume that the child surface should not change its position on that axis when constrained.
If more than one bit for one axis is set, the order of how adjustments are applied is specified in the corresponding adjustment descriptions.
The default adjustment is none.
Gravity
Defines in what direction a popup should be positioned, relative to the anchor point of the parent.
public PopupGravity Gravity { get; set; }
Property Value
Remarks
If a corner gravity is specified (e.g. 'BottomRight' or 'TopLeft'), then the popup will be placed towards the specified gravity; otherwise, the popup will be centered over the anchor point on any axis that had no gravity specified.
Offset
Specify the popup position offset relative to the position of the anchor on the anchor rectangle and the anchor on the popup.
public Point Offset { readonly get; set; }
Property Value
Remarks
For example if the anchor of the anchor rectangle is at (x, y), the popup has the gravity bottom|right, and the offset is (ox, oy), the calculated surface position will be (x + ox, y + oy). The offset position of the surface is the one used for constraint testing. See set_constraint_adjustment.
An example use case is placing a popup menu on top of a user interface element, while aligning the user interface element of the parent surface with some user interface element placed somewhere in the popup.
Size
Set the size of the popup that is to be positioned with the positioner object, in device- independent pixels.
public Size Size { readonly get; set; }
Property Value
Methods
Equals(PopupPositionerParameters)
public readonly bool Equals(PopupPositionerParameters other)
Parameters
Returns
Equals(object)
public override readonly bool Equals(object obj)
Parameters
obj
object
Returns
GetHashCode()
public override readonly int GetHashCode()
Returns
ToString()
public override string ToString()
Returns
Operators
operator ==(PopupPositionerParameters, PopupPositionerParameters)
public static bool operator ==(PopupPositionerParameters left, PopupPositionerParameters right)
Parameters
Returns
operator !=(PopupPositionerParameters, PopupPositionerParameters)
public static bool operator !=(PopupPositionerParameters left, PopupPositionerParameters right)