StackPanel - SirePi/duality-ui GitHub Wiki

The StackPanel layouts its child Controls in a vertical or horizontal stack, according to the StackPanel's Direction property. Derives from ControlsContainer.

In addition to the ControlsContainer's base properties and delegates, it also exposes:

  • Property Direction - The direction in which the stack grows.

The child Controls's Size is extended in order to take all the available space that is not in the dimension that is currently the stacking direction; i.e. Controls in a LeftToRight or RightToLeft StackPanel will be stretched along the Y, or along the X for UpToDown and DownToUp stacks.

The following images display a UpToDown and LeftToRight stacks:

UpToDown LeftToRight
image image

If the child Control's StretchToFill property is set to false, it will use both its Size dimensions, and will appear centered in the stack, as shown in the following image for the Red and Green blocks.

image