DockPanel面板

dockPanel面板是更有趣的面板,他沿着一条边缘来拉伸包含的控件

<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">
    <Border Margin="10" Padding="20" Background="Aqua" BorderBrush="Black" CornerRadius="5">
        <DockPanel LastChildFill="True">
            <Button Margin="5" MinWidth="100" MaxWidth="300" DockPanel.Dock="Top">btn1</Button>
            <Button Margin="5" MinWidth="100" MaxWidth="300" DockPanel.Dock="Bottom">btn2</Button>
            <Button Margin="5" MinWidth="100" MaxWidth="300" DockPanel.Dock="Left">btn3</Button>
            <Button Margin="5" MinWidth="100" MaxWidth="300" DockPanel.Dock="Right">btn4</Button>
            <Button Margin="5" MinWidth="100" MaxWidth="300">btn5</Button>
        </DockPanel>
    </Border>
</Window>