Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    Canvas Class

    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.

    System.Object → UIElement → Panel → Canvas
    Derived from Canvas:

    [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.

    | Improve this Doc View Source

    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>
    | Improve this Doc View Source

    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
    UIElement.ArrangeOverride(Vector3)

    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

    Overrides
    UIElement.MeasureOverride(Vector3)

    Inherited Members

    Panel.ZIndexPropertyKey
    Panel.PanelArrangeMatrixPropertyKey
    Panel.PanelChildrenSorter
    Panel.Children
    Panel.EnumerateChildren()
    Panel.LogicalChildrenChanged(Object, TrackingCollectionChangedEventArgs)
    Panel.OnLogicalChildRemoved(UIElement, Int32)
    Panel.OnLogicalChildAdded(UIElement, Int32)
    Panel.UpdateWorldMatrix(Matrix, Boolean)
    Panel.ActivateAnchoring(Orientation, Boolean)
    Panel.ShouldAnchor(Orientation)
    Panel.GetSurroudingAnchorDistances(Orientation, Single)
    Panel.ScrollOwner
    UIElement.InputCategory
    UIElement.PanelCategory
    UIElement.AppearanceCategory
    UIElement.BehaviorCategory
    UIElement.LayoutCategory
    UIElement.MiscCategory
    UIElement.MarginInternal
    UIElement.ArrangeChanged
    UIElement.LocalMatrixChanged
    UIElement.Id
    UIElement.DependencyProperties
    UIElement.LocalMatrix
    UIElement.BackgroundColor
    UIElement.Opacity
    UIElement.Visibility
    UIElement.ClipToBounds
    UIElement.DrawLayerNumber
    UIElement.IsEnabled
    UIElement.CanBeHitByUser
    UIElement.Width
    UIElement.Height
    UIElement.Depth
    UIElement.Size
    UIElement.HorizontalAlignment
    UIElement.VerticalAlignment
    UIElement.DepthAlignment
    UIElement.Margin
    UIElement.MinimumWidth
    UIElement.MinimumHeight
    UIElement.MinimumDepth
    UIElement.MaximumWidth
    UIElement.MaximumHeight
    UIElement.MaximumDepth
    UIElement.DefaultWidth
    UIElement.DefaultHeight
    UIElement.DefaultDepth
    UIElement.Name
    UIElement.DesiredSize
    UIElement.DesiredSizeWithMargins
    UIElement.IsArrangeValid
    UIElement.IsMeasureValid
    UIElement.WorldMatrix
    UIElement.DepthBias
    UIElement.LayoutingContext
    UIElement.VisualChildrenCollection
    UIElement.InvalidateArrange()
    UIElement.InvalidateMeasure()
    UIElement.OnNameChanged()
    UIElement.IsHierarchyEnabled
    UIElement.IsVisible
    UIElement.IsCollapsed
    UIElement.Parent
    UIElement.VisualParent
    UIElement.VisualChildren
    UIElement.HitableChildren
    UIElement.RenderOpacity
    UIElement.RenderSize
    UIElement.RenderOffsets
    UIElement.ActualWidth
    UIElement.ActualHeight
    UIElement.ActualDepth
    UIElement.IUIElementChildren.Children
    UIElement.Measure(Vector3)
    UIElement.Arrange(Vector3, Boolean)
    UIElement.CollapseOverride()
    UIElement.PropagateCollapseToChild(UIElement)
    UIElement.FindName(String)
    UIElement.SetParent(UIElement, UIElement)
    UIElement.SetVisualParent(UIElement, UIElement)
    UIElement.Intersects(Ray, Vector3)
    UIElement.IUIElementUpdate.Update(GameTime)
    UIElement.IUIElementUpdate.UpdateWorldMatrix(Matrix, Boolean)
    UIElement.IUIElementUpdate.UpdateElementState(Int32)
    UIElement.Update(GameTime)
    UIElement.CalculateSizeWithThickness(Vector3, Thickness)
    UIElement.CalculateSizeWithoutThickness(Vector3, Thickness)
    UIElement.CalculateAdjustmentOffsets(Thickness, Vector3, Vector3)
    UIElement.IsTouched
    UIElement.MouseOverState
    UIElement.RequiresMouseOverUpdate
    UIElement.RaiseEvent(RoutedEventArgs)
    UIElement.AddHandler<T>(RoutedEvent<T>, EventHandler<T>, Boolean)
    UIElement.RemoveHandler<T>(RoutedEvent<T>, EventHandler<T>)
    UIElement.MouseOverStateChanged
    UIElement.PreviewTouchDown
    UIElement.PreviewTouchMove
    UIElement.PreviewTouchUp
    UIElement.TouchDown
    UIElement.TouchEnter
    UIElement.TouchLeave
    UIElement.TouchMove
    UIElement.TouchUp
    UIElement.OnPreviewTouchDown(TouchEventArgs)
    UIElement.OnPreviewTouchMove(TouchEventArgs)
    UIElement.OnPreviewTouchUp(TouchEventArgs)
    UIElement.OnTouchDown(TouchEventArgs)
    UIElement.OnTouchEnter(TouchEventArgs)
    UIElement.OnTouchLeave(TouchEventArgs)
    UIElement.OnTouchMove(TouchEventArgs)
    UIElement.OnTouchUp(TouchEventArgs)

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    UIElementExtensions.SetPanelZIndex(UIElement, Int32)
    UIElementExtensions.GetPanelZIndex(UIElement)
    UIElementExtensions.SetCanvasRelativeSize(UIElement, Vector3)
    UIElementExtensions.GetCanvasRelativeSize(UIElement)
    UIElementExtensions.SetCanvasRelativePosition(UIElement, Vector3)
    UIElementExtensions.GetCanvasRelativePosition(UIElement)
    UIElementExtensions.SetCanvasAbsolutePosition(UIElement, Vector3)
    UIElementExtensions.GetCanvasAbsolutePosition(UIElement)
    UIElementExtensions.SetCanvasPinOrigin(UIElement, Vector3)
    UIElementExtensions.GetCanvasPinOrigin(UIElement)
    UIElementExtensions.SetGridColumn(UIElement, Int32)
    UIElementExtensions.GetGridColumn(UIElement)
    UIElementExtensions.SetGridRow(UIElement, Int32)
    UIElementExtensions.GetGridRow(UIElement)
    UIElementExtensions.SetGridLayer(UIElement, Int32)
    UIElementExtensions.GetGridLayer(UIElement)
    UIElementExtensions.SetGridColumnSpan(UIElement, Int32)
    UIElementExtensions.GetGridColumnSpan(UIElement)
    UIElementExtensions.SetGridRowSpan(UIElement, Int32)
    UIElementExtensions.GetGridRowSpan(UIElement)
    UIElementExtensions.SetGridLayerSpan(UIElement, Int32)
    UIElementExtensions.GetGridLayerSpan(UIElement)
    VisualTreeHelper.FindVisualChildOfType<T>(UIElement, String)
    VisualTreeHelper.FindVisualChildrenOfType<T>(UIElement)
    VisualTreeHelper.FindVisualParentOfType<T>(UIElement)
    VisualTreeHelper.FindVisualRoot(UIElement)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation