Table of Contents

Class StackPanel

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

Arranges child elements into a single line that can be oriented horizontally or vertically.

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

Fields

OrientationToMaximizeIndex1

Indicate the first index of Vector3 to use to maximize depending on the stack panel orientation.

protected static readonly int[] OrientationToMaximizeIndex1

Field Value

int[]

OrientationToMaximizeIndex2

Indicate the second index of Vector3 to use to accumulate depending on the stack panel orientation.

protected static readonly int[] OrientationToMaximizeIndex2

Field Value

int[]

ScrollingModeToInfiniteAxis

Indicate the axis along which the measure zone is infinite depending on the scroll owner scrolling mode.

protected static readonly List<int[]> ScrollingModeToInfiniteAxis

Field Value

List<int[]>

Properties

Extent

Gets the size of the extent. That is the virtual total size of the UIElement.

public Vector3 Extent { get; }

Property Value

Vector3

HitableChildren

The list of the children of the element that can be hit by the user.

protected override FastCollection<UIElement> HitableChildren { get; }

Property Value

FastCollection<UIElement>

ItemVirtualizationEnabled

Gets or sets the value indicating if the StackPanel children must be virtualized or not. When children virtualization is activated, hidden children's measurement, arrangement and draw are avoided.

[DataMember]
[Display(null, "Behavior")]
public bool ItemVirtualizationEnabled { get; set; }

Property Value

bool

Offset

Gets the offset of the scrolled content.

public Vector3 Offset { get; }

Property Value

Vector3

Orientation

Gets or sets a value that indicates the orientation by which child elements are stacked.

[DataMember]
[Display(null, "Layout")]
public Orientation Orientation { get; set; }

Property Value

Orientation

ScrollBarPositions

Get the position of the horizontal, vertical and in depth scroll bars.

public Vector3 ScrollBarPositions { get; }

Property Value

Vector3

A value between 0 and 1 for each component indicating the position of the scroll bar

Remarks

Return 0 for each direction the element cannot scroll

ScrollPosition

The current scroll position of the left/top corner of the stack panel.

public float ScrollPosition { get; }

Property Value

float

Remarks

The stack panel scroll position is expressed element index units. For example: 0 represents the first element, 1 represents the second element, 1.33 represents a third of the second element, etc...

Viewport

Gets the size of the viewport for this content.

public Vector3 Viewport { get; }

Property Value

Vector3

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.

CanScroll(Orientation)

Gets a value that indicates if the UIElement can scroll in the provided direction.

public bool CanScroll(Orientation direction)

Parameters

direction Orientation

The direction in which perform the scrolling

Returns

bool

GetSurroudingAnchorDistances(Orientation, float)

Get the distances to the previous and next anchors in the provided direction and from given position.

public override Vector2 GetSurroudingAnchorDistances(Orientation direction, float position)

Parameters

direction Orientation

The direction in which to anchor

position float

The current scrolling position

Returns

Vector2

The distances to previous and next anchors from to current scroll position

Remarks

The distance contained in the X component of the returned vector is inferior or equal to 0 and the distance contained in the Y component is superior or equal to 0.

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

OnLogicalChildAdded(UIElement, int)

Action to perform when a logical child is added.

protected override void OnLogicalChildAdded(UIElement newElement, int index)

Parameters

newElement UIElement

The element that has been added

index int

The index in the collection where the child has been added

OnLogicalChildRemoved(UIElement, int)

Action to perform when a logical child is removed.

protected override void OnLogicalChildRemoved(UIElement oldElement, int index)

Parameters

oldElement UIElement

The element that has been removed

index int

The index of the child removed in the collection

ScrollOf(Vector3)

Increase the amount of offset from the current scrolling position.

public void ScrollOf(Vector3 offsetsToApply)

Parameters

offsetsToApply Vector3

ScrollOf(float)

Scroll of the provided offset from the current position in the direction given by the stack panel Orientation .

public void ScrollOf(float offsetToApply)

Parameters

offsetToApply float

The value to scroll off

ScrollToBeginning()

Scroll to the beginning of the StackPanel.

public void ScrollToBeginning()

Remarks

Equivalent to ScrollToBeginning(Orientation) called with the value Orientation

ScrollToBeginning(Orientation)

Go to the beginning of the element in the given the direction.

public void ScrollToBeginning(Orientation direction)

Parameters

direction Orientation

The direction in which to scroll

ScrollToEnd()

Scroll to the end of the StackPanel.

public void ScrollToEnd()

Remarks

Equivalent to ScrollToEnd(Orientation) called with the value Orientation

ScrollToEnd(Orientation)

Go to the end of the element in the given the direction.

public void ScrollToEnd(Orientation direction)

Parameters

direction Orientation

The direction in which to scroll

ScrollToNextLine()

Scroll to the next element of the StackPanel.

public void ScrollToNextLine()

Remarks

Equivalent to ScrollToNextLine(Orientation) called with the value Orientation

ScrollToNextLine(Orientation)

Go to the next line in the given the direction.

public void ScrollToNextLine(Orientation direction)

Parameters

direction Orientation

The direction in which to scroll

ScrollToNextPage()

Scroll to the next page of elements of the StackPanel.

public void ScrollToNextPage()

Remarks

Equivalent to ScrollToNextPage(Orientation) called with the value Orientation

ScrollToNextPage(Orientation)

Go to the next page in the given the direction.

public void ScrollToNextPage(Orientation direction)

Parameters

direction Orientation

The direction in which to scroll

ScrollToPreviousLine()

Scroll to the previous element of the StackPanel.

public void ScrollToPreviousLine()

Remarks

Equivalent to ScrollToPreviousLine(Orientation) called with the value Orientation

ScrollToPreviousLine(Orientation)

Go to the previous line in the given the direction.

public void ScrollToPreviousLine(Orientation direction)

Parameters

direction Orientation

The direction in which to scroll

ScrollToPreviousPage()

Scroll to the previous page of elements of the StackPanel.

public void ScrollToPreviousPage()

Remarks

Equivalent to ScrollToPreviousPage(Orientation) called with the value Orientation

ScrollToPreviousPage(Orientation)

Go to the previous page in the given the direction.

public void ScrollToPreviousPage(Orientation direction)

Parameters

direction Orientation

The direction in which to scroll

ScrolllToElement(float)

Jump to the element having the provided index.

public void ScrolllToElement(float elementIndex)

Parameters

elementIndex float

The index (0-based) of the element in the stack panel to jump to