C# 与具有多行的网格相比,用于XAML的控件更好
如果您想要组织一个包含许多行的网格的XAML页面,并且发现自己在开发过程中不断需要对页面进行调整,那么这似乎有点低效。例如,需要在插入后将每个控件上的属性从行=40更改为行=41,然后在顶部插入后沿行向下更改属性。网格似乎是我找到的控制布局的最佳控件,但还有其他控件。在这种多行多列的情况下,最好使用什么控件C# 与具有多行的网格相比,用于XAML的控件更好,c#,wpf,xaml,xamarin,C#,Wpf,Xaml,Xamarin,如果您想要组织一个包含许多行的网格的XAML页面,并且发现自己在开发过程中不断需要对页面进行调整,那么这似乎有点低效。例如,需要在插入后将每个控件上的属性从行=40更改为行=41,然后在顶部插入后沿行向下更改属性。网格似乎是我找到的控制布局的最佳控件,但还有其他控件。在这种多行多列的情况下,最好使用什么控件 <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Au
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
只有自动行的网格的完美替代品是StackPanel:
<StackPanel>
<TextBlock Text="Row 1"/>
...
<TextBlock Text="Row N"/>
<StackPanel>
如果所有行的高度都设置为AutoR,如果行是动态的,则可以使用DokPoad或StkPANLAND。
<UniformGrid Columns="1">
<TextBlock Text="Row 1"/>
...
<TextBlock Text="Row N"/>
</UniformGrid>