DockPanel StackPanel WrapPanel这些面板很少单独使用,对窗口的控件进行布局很多时候都是嵌套使用的。
下面是DockPanel 和StackPanel的嵌套使用 ,创建一个对话框。
<DockPanel LastChildFill="True">
<StackPanel DockPanel.Dock="Bottom" HorizontalAlignment="Right" Orientation="Horizontal">
<Button Margin="10,10,2,10" Padding="3">OK</Button>
<Button Margin="2,10,10,10" Padding="3">Cancel</Button>
</StackPanel>
<TextBox DockPanel.Dock="Top" Margin="10">This is a Dialog</TextBox>
</DockPanel>