Search This Blog

Monday, November 11, 2013

StackPanel WPF

WPF > Controls > Layout > StackPanel

StackPanel arranges its elements into a single line that can be oriented horizontally or vertically.

Example:


XAML

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <StackPanel>
        <Button Content="Button" Margin="0,0,385,0"/>
        <ComboBox Margin="0,0,211,0"/>
        <Label Content="Label"/>
        <TextBox Height="65" TextWrapping="Wrap" Text="TextBox"/>
    </StackPanel>
</Window>