- 10 Feb 2022
- 1 Minute to read
-
Print
-
DarkLight
Horizontal and Vertical Stacks
- Updated on 10 Feb 2022
- 1 Minute to read
-
Print
-
DarkLight
Overview
The Horizontal and Vertical Stack Layouts dynamically resize its and its child controls within upon expanding/shrinking a child control. Each added control automatically resizes to the height of the workspace; however, the width measurement of a child control can be manually adjusted.
A recommended best practice involves populating a Stack Layout with a Grid Layout and then to populate the Grid with the desired controls.
With the nested Grid Layout, its columns and rows help uniformly organize controls. Remember to rename the Stack, Grid, and any child controls for best organization practices.
A limitation of Stacks Layouts; however, is that it cannot dynamically resize the Form: stacks will not grow or shrink the whole Form's size.
This document will demonstrate how to use the Horizontal Stack Layout, but similar configurations are applicable to the Vertical Stack Layout.
Configuration
Besides naming the Stack, the Children Size Mode setting determines how its child controls are sized within the Stack. By default, this is set to Scroll.
Children Size Mode Option | Description |
---|---|
Scroll | Allows total size of child controls to extend beyond that of the Stack's dimensions by including a horizontal/vertical scrollbar to navigate |
ExpandChildrenThenScroll | Allows child controls to expand increasing their size in the Stack. This can also extend beyond the Stack's dimensions thus supports a scrollbar. |
FitChildren | Allows child controls to resize according to the size of Stack. Since this setting is constrained by the Stack's dimensions, no scrollbar is supported. |