Layout a Form with StackPanel and Grid
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="UseExpander" Height="300" Width="300">
<Grid>
<StackPanel Name="StackPanel1" Margin="0,0,0,0">
<Expander Header="Name" Margin="0,0,0,0" Name="Expander1" IsExpanded="True">
<StackPanel Margin="20,0,0,0">
<StackPanel Height="Auto" Width="Auto" Orientation="Horizontal">
<Label Height="25.96" Width="84">First Name</Label>
<TextBox Height="25" Width="147" />
</StackPanel>
<StackPanel Height="Auto" Width="Auto" Orientation="Horizontal">
<Label Height="25.96" Width="84">Last Name</Label>
<TextBox Height="25" Width="147" />
</StackPanel>
</StackPanel>
</Expander>
<Separator />
<Expander Header="Address" Margin="0,0,0,0" IsExpanded="True">
<StackPanel Margin="20,0,0,0" >
<StackPanel Height="Auto" Width="Auto" Orientation="Horizontal">
<Label Height="25.96" Width="84">Street</Label>
<TextBox Height="25" Width="147" />
</StackPanel>
<StackPanel Height="Auto" Width="Auto" Orientation="Horizontal">
<Label Height="25.96" Width="84">City</Label>
<TextBox Height="25" Width="147" />
</StackPanel>
<StackPanel Height="Auto" Width="Auto" Orientation="Horizontal">
<Label Height="25.96" Width="84">State</Label>
<TextBox Height="25" Width="147" />
</StackPanel>
<StackPanel Height="Auto" Width="Auto" Orientation="Horizontal">
<Label Height="25.96" Width="84">Zip</Label>
<TextBox Height="25" Width="147" />
</StackPanel>
</StackPanel>
</Expander>
<Separator />
</StackPanel>
</Grid>
</Window>
Related examples in the same category