Tôi có một mạng lưới với 3 cột và 5 dòng:Wpf: Lưới: Làm thế nào tôi có thể chia sẻ chiều rộng chiều cao cột/hàng?
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0">Gas Volume Fraction</Label>
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Path=GasVolumeFraction}" MinWidth="40"></TextBox>
<Label Grid.Row="0" Grid.Column="2">-</Label>
<Label Grid.Row="1" Grid.Column="0">Density</Label>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Path=Density}" MinWidth="40"></TextBox>
<Label Grid.Row="1" Grid.Column="2">kg/m3</Label>
<Label Grid.Row="2" Grid.Column="0" Content="Curve speed" Style="{StaticResource curveSpeed}" ></Label>
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Path=Density}" Style="{StaticResource curveSpeed}" MinWidth="40"></TextBox>
<Label Grid.Row="2" Grid.Column="2" Style="{StaticResource curveSpeed}">rpm</Label>
<WrapPanel Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="3">
<RadioButton>Delta pressure</RadioButton>
<RadioButton>Head</RadioButton>
</WrapPanel>
<WrapPanel Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="3">
<RadioButton>Efficiency</RadioButton>
<RadioButton>Power</RadioButton>
<RadioButton>Torque</RadioButton>
</WrapPanel>
</Grid>
Các textbox và radiobutton có những yêu cầu không gian khác nhau, mà làm cho các hàng render với chiều cao khác nhau dựa trên nội dung của họ. Làm thế nào tôi có thể làm cho các hàng có kích thước đồng đều, nhưng không lớn hơn những gì cần thiết? Nói cách khác: Tôi muốn cùng chiều cao như thiết lập Height = "Auto" cho một hàng có chứa một hộp văn bản (phần tử lớn nhất trong lưới của tôi) và sau đó sử dụng chiều cao đó cho tất cả các hàng.
Sau đó bạn mong đợi điều gì xảy ra với WrapPanels? Nếu bạn hạn chế chiều cao của họ, họ phải có phòng để phát triển theo chiều ngang. – slugster