<Grid x:Name="myGrid" HorizontalOptions="FillAndExpand" VerticalOptions="StartAndExpand" ColumnSpacing="1" RowSpacing="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="50"></RowDefinition>
</Grid.RowDefinitions>
</Grid>
您好,以上是我的网格,其中包含3列和多行(数百个)。我可以知道如何不必为<RowDefinition Height="40"></RowDefinition>
键入100而为每一行平均设置高度。现在,如果执行此操作,它将仅在第一行高度上渲染40,其余行恢复为默认高度。
我当前正在做的是在代码隐藏区的循环内调用myGrid.RowDefinitions.Add(new RowDefinition() { Height = 50 });
,因为我的数据是从代码隐藏区填充的。
有什么更好的方法?谢谢。