Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/259.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# 网格wp8.1通用设置值崩溃_C#_Xaml_Grid_Universal_Setvalue - Fatal编程技术网

C# 网格wp8.1通用设置值崩溃

C# 网格wp8.1通用设置值崩溃,c#,xaml,grid,universal,setvalue,C#,Xaml,Grid,Universal,Setvalue,我正在尝试在枢轴的一个部分设计6块纵向和横向瓷砖。我想要3x2(3行)的纵向瓷砖和2x3的横向瓷砖。它在两种模式下均显示3x2,无c#代码,但添加该代码后,在第一次设置值时崩溃 我的xaml代码: <Grid> <Grid.RowDefinitions> <RowDefinition Height="172"/>

我正在尝试在枢轴的一个部分设计6块纵向和横向瓷砖。我想要3x2(3行)的纵向瓷砖和2x3的横向瓷砖。它在两种模式下均显示3x2,无c#代码,但添加该代码后,在第一次设置值时崩溃

我的xaml代码:

 <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="172"/>
                            <RowDefinition Height="172"/>
                            <RowDefinition x:Name="more_3rdrow" Height="172"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="172"/>
                            <ColumnDefinition Width="172"/>
                            <ColumnDefinition x:Name="more_3rdcolumn" Width="0"/>
                    </Grid.ColumnDefinitions>
                      <Grid Grid.Row="0" Grid.Column="0" x:Name="contacttile">
                         some data here
                      </Grid>
                      <Grid Grid.Row="0" Grid.Column="1" x:Name="ratetile">
                         some data here
                      </Grid>
                      <Grid Grid.Row="1" Grid.Column="0" x:Name="moreappstile">
                         some data here
                        </Grid>

                      more grids here
</Grid>

RowDefinition DependendyObject中的高度不是GridLength类的两倍,因此必须使用:

more_3rdrow.SetValue(RowDefinition.HeightProperty, new GridLength(172));
这是因为您可以定义自动、1*或固定大小。所以也要小心定义

more_3rdrow.SetValue(RowDefinition.HeightProperty, new GridLength(172));