Stack Panel Layout

Stack panel layout arrange control either vertically or horizontally. At the time of stack layout creation you have to set the property Orientation either as Vertical or as Horizontal.

For Example

You can check the following code as example of stack layout:-

 
	<Window x:Class="WpfApplication2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Tech Altum" Height="500" Width="700">

    <StackPanel Orientation="Vertical">
        <Label>What is your Favourite Colour</Label>
        <Button >Red</Button>
        <Button >Green</Button>
        <Button >Blue</Button>
        <Button >Pink</Button>
    </StackPanel>
</Window>

		

The output of this example as follows:-

stack Layout in WPF Figure 1