1.DockPanel水平或竖直地布局子元素,相对于另一个;
2.HorizontalAlignment: Left, Right, Center ,Stretch
3. VerticalAlignment: Top, Center, Bottom , Stretch
4. 由于每个控件都要Top/Botton/Left/Right这样靠在一个边上,所以剩下的空间总是一个矩形,而后来的控件占据该矩形一边后,又形成一个新的矩形
<DockPanel Name="dockPanel1">
<ProgressBar Height="20" Name="progressBar1" DockPanel.Dock="Top" VerticalAlignment="Top" />
<MediaElement Name="mediaElement1" Width="160" HorizontalAlignment="Left" />
<ScrollBar Name="scrollBar1" Orientation="Horizontal" Height="20" VerticalAlignment="Bottom" />
<WebBrowser Name="webBrowser1" />
</DockPanel>
|