Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/svn/5.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
Xaml 在代码中创建行定义和列定义_Xaml_Windows Phone - Fatal编程技术网

Xaml 在代码中创建行定义和列定义

Xaml 在代码中创建行定义和列定义,xaml,windows-phone,Xaml,Windows Phone,我正在为windows phone开发应用程序, 我想创建一个包含两行和两列的表 我为这个表创建xaml代码 <Grid Background="White"> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <Grid.RowDefi

我正在为windows phone开发应用程序, 我想创建一个包含两行和两列的表 我为这个表创建xaml代码

<Grid Background="White">   
    <Grid.ColumnDefinitions>
        <ColumnDefinition/>
        <ColumnDefinition/> 
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition />
        <RowDefinition /> 
    </Grid.RowDefinitions/>      
</Grid>
但我不知道如何创建行定义和列定义

Grid newGrid = new Grid();
newGrid.Background = new SolidColorBrush(Colors.White);
newGrid.ColumnDefinitions.Add(new ColumnDefinition());
newGrid.ColumnDefinitions.Add(new ColumnDefinition());
newGrid.RowDefinitions.Add(new RowDefinition());
newGrid.RowDefinitions.Add(new RowDefinition());
要在特定单元格中定位元素,请执行以下操作:

Grid chat_userpicgrid = new Grid();
Grid.SetColumn(chat_userpicgrid, 1);
Grid.SetRow(chat_userpicgrid, 1);
newGrid.Children.Add(chat_userpicgrid);
看看

Grid chat_userpicgrid = new Grid();
Grid.SetColumn(chat_userpicgrid, 1);
Grid.SetRow(chat_userpicgrid, 1);
newGrid.Children.Add(chat_userpicgrid);