Table of Contents

Class Canvas

Namespace
Stride.UI.Panels
Assembly
Stride.UI.dll

Defines an area within which you can position and size child elements with respect to in the Canvas area size.

[DataContract("Canvas")]
public class Canvas : Panel, IUIElementUpdate, IUIElementChildren, IIdentifiable, IScrollAnchorInfo
Inheritance
Canvas
Implements
Inherited Members
Extension Methods

Fields

AbsolutePositionPropertyKey

The key to the AbsolutePosition dependency property. AbsolutePosition indicates where the UIElement is pinned in the canvas.

[Display(null, "Layout")]
public static readonly PropertyKey<Vector3> AbsolutePositionPropertyKey

Field Value

PropertyKey<Vector3>

PinOriginPropertyKey

The key to the PinOrigin dependency property. The PinOrigin indicate which point of the UIElement should be pinned to the canvas.

[Display(null, "Layout")]
public static readonly PropertyKey<Vector3> PinOriginPropertyKey

Field Value

PropertyKey<Vector3>

Remarks

Those values are normalized between 0 and 1. (0,0,0) represent the Left/Top/Back corner and (1,1,1) represent the Right/Bottom/Front corner. UIElement's margins are included in the normalization. Values beyond [0,1] are clamped.

RelativePositionPropertyKey

The key to the RelativePosition dependency property. RelativePosition indicates where the UIElement is pinned in the canvas.

[Display(null, "Layout")]
public static readonly PropertyKey<Vector3> RelativePositionPropertyKey

Field Value

PropertyKey<Vector3>

RelativeSizePropertyKey

The key to the RelativeSize dependency property. RelativeSize indicates the ratio of the size of the UIElement with respect to the parent size.

[Display(null, "Layout")]
public static readonly PropertyKey<Vector3> RelativeSizePropertyKey

Field Value

PropertyKey<Vector3>

Remarks

Relative size must be strictly positive

UseAbsolutePositionPropertyKey

The key to the UseAbsolutionPosition dependency property. This indicates whether to use the AbsolutePosition or the RelativePosition to place to element.

[Display(null, "Layout")]
public static readonly PropertyKey<bool> UseAbsolutePositionPropertyKey

Field Value

PropertyKey<bool>

Methods

ArrangeOverride(Vector3)

When overridden in a derived class, positions possible child elements and determines a size for a UIElement derived class.

protected override Vector3 ArrangeOverride(Vector3 finalSizeWithoutMargins)

Parameters

finalSizeWithoutMargins Vector3

The final area within the parent that this element should use to arrange itself and its children.

Returns

Vector3

The actual size used.

ComputeAbsolutePinPosition(UIElement, ref Vector3)

Compute the child absolute position in the canvas according to parent size and the child layout properties.

protected Vector3 ComputeAbsolutePinPosition(UIElement child, ref Vector3 parentSize)

Parameters

child UIElement

The child to place

parentSize Vector3

The parent size

Returns

Vector3

The child absolute position offset

MeasureOverride(Vector3)

When overridden in a derived class, measures the size in layout required for possible child elements and determines a size for the UIElement-derived class.

protected override Vector3 MeasureOverride(Vector3 availableSizeWithoutMargins)

Parameters

availableSizeWithoutMargins Vector3

The available size that this element can give to child elements. Infinity can be specified as a value to indicate that the element will size to whatever content is available.

Returns

Vector3

The size desired by the children