WPF网格布局

Ond*_*cek 4 wpf grid layout

是否可以使用WPF中的Grid设计类似的东西?设计列很简单,但行怎么样?还是有更好的解决方案,比如另一个容器?想象每个矩形作为模块(GroupBox).

网格布局

HCL*_*HCL 5

使用两列创建外部网格.在此网格中,放置另外两个网格,每列一个.这将导致所需的布局.

这里有一个如何做的例子.请注意,我已经为高处放置了一些星星.根据您的需要更改它们.

<Grid>
 <Grid.ColumnDefinitions>
   <Grid.ColumnDefinition Width="*" />
   <Grid.ColumnDefinition Width="*" />
 <Grid.ColumnDefinitions>

 <Grid Grid.Column="0">
   <Grid.RowDefinitions>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="Auto"/>
      <RowDefinition Height="*"/>
   </Grid.RowDefinitions>

   <!-- Here content elements of the first column -->

 </Grid>

 <Grid Grid.Column="1">
   <Grid.RowDefinitions>
      <RowDefinition Height="*"/>
      <RowDefinition Height="*"/>
   </Grid.RowDefinitions>

   <!-- Here content elements of the second column -->

 </Grid>


</Grid>
Run Code Online (Sandbox Code Playgroud)