WPF DockPanelレイアウトで
开发工具与关键技术:Visual Studio 2015、WPF
作者:黄元进
撰写时间:2019年4月14日
DockPanelは、この地域では、地域を定義するには、サブ要素は、Childrenプロパティにあるオブジェクトのプロット点の形で配置されていることができます。DockPanelは、各サブ要素をソートするであろう、そして、指定された側面に係るプレス順序の同じ側の停止複数の要素を駐車します。XAMLコードは、次のことを達成するために使用します:
<Window x:Class="DockPanel布局.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<DockPanel>
<Button DockPanel.Dock="Bottom" Content="yi" Height="30"></Button>
<Button DockPanel.Dock="Left" Content="er" Width="30"></Button>
<Button DockPanel.Dock="Right" Content="san" Width="30"></Button>
<Button DockPanel.Dock="Top" Content="si" Height="30"></Button>
<StackPanel>
<TextBlock Width="50">44444</TextBlock>
</StackPanel>
</DockPanel>
</Window>
結果を達成する:
DockPanelで、制御のドッキングエッジを指定し、定義された順序でコーナーを占有され、すべてのコントロールが重複することはありません。