是否可以在 WPF 中使用 Grid 来设计类似的东西?设计列很容易,但是行呢?或者有没有更好的解决方案,比如另一个容器?将每个矩形想象为模块(GroupBox)。
创建一个包含两列的外部网格。在此网格中,放置另外两个网格,每列一个。这将导致所需的布局。
这里有一个如何做的例子。请注意,我为高度添加了一些星星。根据您的需要更改它们。
<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>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)