我在wpf(xaml)中有一个巨大的网格
<Grid Width="400" Height="400">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
...
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label>1</Label>
<TextBox Grid.Column="1"></TextBox>
<Label Grid.Row="1">1</Label>
<TextBox Grid.Column="1" Grid.Row="1"></TextBox>
<Label Grid.Row="2">2</Label>
<TextBox Grid.Column="1" Grid.Row="2"></TextBox>
...
...
...
我想在网格顶部添加一行。目前,我通过 Grid.Row =“2”和 Grid.Row =“2”更改 Grid.Row =“1” Grid.Row =“3” ......真的很痛苦!
是否有任何解决方案可以在不更改所有ID的情况下添加行?