Using the StackPanel layout panel
A StackPanel layout panel allows you to stack objects in an assigned direction. Based on the properties that you define within a StackPanel layout panel, content can flow both vertically (by default) and horizontally. A StackPanel layout panel is predominantly used within list controls, such as within a ListBox control or within the pop-up list in a ComboBox control. Any object that you create or draw within a StackPanel layout panel will be added automatically as the last child object in the stacking order of the objects in the panel. As you add more child objects, you will see that the StackPanel layout panel will clip (or hide) those objects that do not fit.
**Orientation ** By default, the objects within a StackPanel layout panel are stacked vertically, but you can also stack them horizontally.
**Nested Panels ** You can use a nested layout panel (in other words, you can use a layout panel as a child object) to contain the side-by-side objects. The nested panel stacks in exactly the same way as any other child objects contained within the parent StackPanel layout panel.
Add a StackPanel layout panel to a document by selecting StackPanel from the Assets panel or from the layout container button in the Tools panel, and then dragging on the artboard. The following XAML code is added to your project:
<Grid x:Name="LayoutRoot">
<StackPanel HorizontalAlignment="Left" Height="100" VerticalAlignment="Top" Width="100"/>
</Grid>
For more information about working with the StackPanel layout panel, see Change the stacking order and Change the stack orientation.
Objects in a stack panel set to vertical orientation