WPF布局(3) 嵌套使用布局容器

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>



posted @ 2011-12-27 22:40  William Jiang  阅读(668)  评论(0编辑  收藏  举报