DockPanel

DockPanel非常类似于Windows窗体的停靠功能。DockPanel可以指定排列子控件的区域。

DockPanel定义了相关的Dock属性, 可以在控件的子控件中将它设置为Left,Right,Top和Bottom。

显示了排列在DockPanel中的带边框的文本框。为了便于区别,为不同的区域指定了不同的颜色:

<Window x:Class="Panel布局.DockPanel"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="DockPanel" Height="300" Width="300">
    <DockPanel>
        <Border Height="25" Background="AliceBlue" DockPanel.Dock="Top">
            <TextBlock>Menu</TextBlock>
        </Border>
        <Border Height="25" Background="LightSteelBlue" DockPanel.Dock="Bottom">
            <TextBlock>Status</TextBlock>
        </Border>
        <Border Height="80" Background="Azure" DockPanel.Dock="Left">
            <TextBlock>Left Side</TextBlock>
        </Border>
        <Border BindingGroup="" Background="HotPink" DockPanel.Dock="Right">
            <TextBlock>Reminning Part</TextBlock>
        </Border>
    </DockPanel>
</Window>

原文地址:https://www.cnblogs.com/hdsong/p/5076363.html