Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 与具有多行的网格相比,用于XAML的控件更好_C#_Wpf_Xaml_Xamarin - Fatal编程技术网

C# 与具有多行的网格相比,用于XAML的控件更好

C# 与具有多行的网格相比,用于XAML的控件更好,c#,wpf,xaml,xamarin,C#,Wpf,Xaml,Xamarin,如果您想要组织一个包含许多行的网格的XAML页面,并且发现自己在开发过程中不断需要对页面进行调整,那么这似乎有点低效。例如,需要在插入后将每个控件上的属性从行=40更改为行=41,然后在顶部插入后沿行向下更改属性。网格似乎是我找到的控制布局的最佳控件,但还有其他控件。在这种多行多列的情况下,最好使用什么控件 <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Au

如果您想要组织一个包含许多行的网格的XAML页面,并且发现自己在开发过程中不断需要对页面进行调整,那么这似乎有点低效。例如,需要在插入后将每个控件上的属性从行=40更改为行=41,然后在顶部插入后沿行向下更改属性。网格似乎是我找到的控制布局的最佳控件,但还有其他控件。在这种多行多列的情况下,最好使用什么控件

<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>