StackPanel
Description
A container control that lays its children out along one axis — vertical by default — with optional Spacing between them and WPF-style star sizing. Extends AbstractContainerControl (itself a Vulkan Control). Declarable from UI XML as <StackPanel>.
API summary
| Member | Kind | Summary |
|---|---|---|
Measure(availableSize) | override | Two-pass measure: size fixed children, then distribute leftover main-axis space across star children. |
Arrange(finalRect) | override | Position children along the main axis (cursor + spacing), align each on the cross axis. |
Fields & Properties
[A_XSDElementProperty("Orientation", "UI")]
public Orientation orientation = Orientation.Vertical; // Horizontal | Vertical
[A_XSDElementProperty("Spacing", "UI", "Space between children in pixels.")]
public float Spacing = 0f;
Methods
Measure (2-pass)
Pass 1 measures non-star children (and accumulates star weights); pass 2 distributes the remaining main-axis space to star children by weight. Cross-axis size is the max child cross size. Spacing is added between children.
Arrange
Recomputes the star allocation against the final size, then walks a cursor along the main axis placing each child, applying margins and cross-axis alignment (Stretch/Left/Center/Right, etc.).
XML
<StackPanel Orientation="Vertical" Spacing="8">
<!-- child controls -->
</StackPanel>
Related
- Vulkan Control — base control + layout fields (
heightStar,margin, alignment) - Sibling containers: Grid, Scrollable, Docking