[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

你可能感兴趣的:(layout)