Canvas Class
Namespace: Stride.UI.PanelsAssembly: 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
Name | Description | |
---|---|---|
Fields | ||
AbsolutePositionPropertyKey | The key to the AbsolutePosition dependency property. AbsolutePosition indicates where the UIElement is pinned in the canvas. |
|
PinOriginPropertyKey | The key to the PinOrigin dependency property. The PinOrigin indicate which point of the UIElement should be pinned to the canvas. |
|
RelativePositionPropertyKey | The key to the RelativePosition dependency property. RelativePosition indicates where the UIElement is pinned in the canvas. |
|
RelativeSizePropertyKey | The key to the RelativeSize dependency property. RelativeSize indicates the ratio of the size of the UIElement with respect to the parent size. |
|
UseAbsolutePositionPropertyKey | The key to the UseAbsolutionPosition dependency property. This indicates whether to use the AbsolutePosition or the RelativePosition to place to element. |
|
Methods | ||
ArrangeOverride(Vector3) | When overridden in a derived class, positions possible child elements and determines a size for a UIElement derived class. |
|
ComputeAbsolutePinPosition(UIElement, ref Vector3) | Compute the child absolute position in the canvas according to parent size and the child layout properties. |
|
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. |
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
Type | Description |
---|---|
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
Type | Description |
---|---|
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
Type | Description |
---|---|
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
Type | Description |
---|---|
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
Type | Description |
---|---|
PropertyKey<System.Boolean> |
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
Type | Name | Description |
---|---|---|
Vector3 | finalSizeWithoutMargins | The final area within the parent that this element should use to arrange itself and its children. |
Returns
Type | Description |
---|---|
Vector3 | The actual size used. |
Overrides
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
Type | Name | Description |
---|---|---|
UIElement | child | The child to place |
Vector3 | parentSize | The parent size |
Returns
Type | Description |
---|---|
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
Type | Name | Description |
---|---|---|
Vector3 | availableSizeWithoutMargins | 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
Type | Description |
---|---|
Vector3 | The size desired by the children |