Skip to main content

PopupPositionerParameters Struct

Definition

Assembly:Avalonia.Controls
Package:Avalonia
public struct PopupPositionerParameters

Inheritance: ValueType -> PopupPositionerParameters

Implements: IEquatable<PopupPositionerParameters>

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.

Methods

NameDescription
Equals (2 overloads)No summary available.
GetHashCodeNo summary available.
ToStringNo summary available.

Equals overloads

Equals Method

public bool Equals(Avalonia.Controls.Primitives.PopupPositioning.PopupPositionerParameters other)
Parameters

other Avalonia.Controls.Primitives.PopupPositioning.PopupPositionerParameters

Returns

bool

Equals Method

public bool Equals(object obj)
Parameters

obj object

Returns

bool

GetHashCode Method

public int GetHashCode()

Returns

int

ToString Method

public string ToString()

Returns

string

Properties

NameDescription
AnchorDefines the anchor point for the anchor rectangle.
AnchorRectangleSpecifies the anchor rectangle within the parent that the popup will be placed relative to, in device-independent pixels.
ConstraintAdjustmentSpecify how the popup should be positioned if the originally intended position caused the popup to be constrained.
GravityDefines in what direction a popup should be positioned, relative to the anchor point of the parent.
OffsetSpecify the popup position offset relative to the position of the anchor on the anchor rectangle and the anchor on the popup.
SizeSet the size of the popup that is to be positioned with the positioner object, in device- independent pixels.

Anchor Property

Defines the anchor point for the anchor rectangle.

public Avalonia.Controls.Primitives.PopupPositioning.PopupAnchor Anchor { get; set; }

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 Property

Specifies the anchor rectangle within the parent that the popup will be placed relative to, in device-independent pixels.

public Avalonia.Rect AnchorRectangle { get; set; }

Remarks

The rectangle is relative to the parent geometry and may not extend outside the window geometry of the popup's parent.

ConstraintAdjustment Property

Specify how the popup should be positioned if the originally intended position caused the popup to be constrained.

public Avalonia.Controls.Primitives.PopupPositioning.PopupPositionerConstraintAdjustment ConstraintAdjustment { get; set; }

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 Property

Defines in what direction a popup should be positioned, relative to the anchor point of the parent.

public Avalonia.Controls.Primitives.PopupPositioning.PopupGravity Gravity { get; set; }

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 Property

Specify the popup position offset relative to the position of the anchor on the anchor rectangle and the anchor on the popup.

public Avalonia.Point Offset { get; set; }

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 Property

Set the size of the popup that is to be positioned with the positioner object, in device- independent pixels.

public Avalonia.Size Size { get; set; }