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

相关文章:

  • 2021-05-27
  • 2022-12-23
  • 2021-05-28
  • 2021-07-12
  • 2021-09-09
  • 2021-08-08
  • 2021-10-21
  • 2021-05-30
猜你喜欢
  • 2021-12-20
  • 2021-11-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-07
相关资源
相似解决方案