StackPanel
Arrange children vertically or horizontally with predictable spacing.
StackPanel arranges visible children in one line. It is vertical by default; set Orientation.Horizontal for a row.
The panel measures children with unlimited space along the stacking axis and the available size across it. A vertical stack therefore asks for the sum of visible child heights, its vertical spacing, and padding. Its width is the widest child unless an ancestor stretches it.
Horizontal rows
Children keep their measured size along the stack. Across the stack they receive the full inner slot and apply their own alignment. Use a Grid when one element must consume the remaining horizontal space while another remains fixed.
Visibility and live children
Spacing is inserted only between visible children. Setting a child's IsVisible to false removes its size and adjacent gap from layout.
The Children collection is live. Adding, removing, or moving a child invalidates the stack and updates its native hierarchy. Use this for genuinely structural changes; use bindings for text, state, and visibility changes within a stable structure.