[WPF系列]-Layout

DockPanel

The nice thing about dock panels is they already fill all the available space. LastChildFill is true by default (but I set it below for clarity), so just don't set the DockPanel attribute on the last child, and it will fill the available space.

<DockPanel HorizontalAlignment="Stretch" LastChildFill="true">
    <TextBlock DockPanel.Dock="Left"
               Text="{Binding Path=Name}"
               FontSize="10"
               Foreground="Black" />
    <TextBlock 
               Text="{Binding Path=Price, StringFormat=\{0:C\}}"
               FontSize="10"
               Foreground="Black" />
</DockPanel>

 

WrapPanel

 

StackPanel

 

Grid

 

GridSpilter

 

参考

WPF Tutorial : Layout-Panels-Containers & Layout Transformation

posted @ 2015-03-19 10:22  霍旭东  阅读(424)  评论(0编辑  收藏  举报