学习WPF——WPF布局——初识布局容器http://www.cnblogs.com/liulun/p/4190353.html
<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">
<StackPanel>
<Button Content="按钮"></Button>
<Button Content="按钮"></Button>
<Button Content="按钮"></Button>
<Button Content="按钮"></Button>
<Label Content="Label"></Label>
<Label Content="Label"></Label>
<Label Content="Label"></Label>
</StackPanel>
</Window>
如果要横向布局的话,只要把StackPanel的Orientation属性设置成Horizontal即可
这个属性的默认值是Vertical
<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">
<StackPanel Orientation="Horizontal">
<Button Content="按钮"></Button>
<Button Content="按钮"></Button>
<Button Content="按钮"></Button>
<Button Content="按钮"></Button>
<Label Content="Label"></Label>
<Label Content="Label"></Label>
<Label Content="Label"></Label>
</StackPanel>
</Window>