Xamarin.forms 具有不同列数的行的网格
是否可以通过编程方式创建一个包含3行和2列的网格,但最后一行只有1列而不是2列Xamarin.forms 具有不同列数的行的网格,xamarin.forms,Xamarin.forms,是否可以通过编程方式创建一个包含3行和2列的网格,但最后一行只有1列而不是2列 public class MyGrid : Grid { public void DefineRowsAndColumns() { // I know you can add RowDefinitions and ColumnDefinitions here, but how to make them uneven? } } 我不是想找人来做作业……我只是想知道如何让网格中的
public class MyGrid : Grid
{
public void DefineRowsAndColumns()
{
// I know you can add RowDefinitions and ColumnDefinitions here, but how to make them uneven?
}
}
我不是想找人来做作业……我只是想知道如何让网格中的行具有不同的列数。您可以使用ColumnSpan属性使内容跨越多个列
var label = new Label { Text = "Row 1" };
myGrid.Children.Add(label,0,0);
Grid.SetColumnSpan(label,2);
标签将跨越两列,有效地使该行仅包含一列您可以使用ColumnSpan属性使内容跨越多列
var label = new Label { Text = "Row 1" };
myGrid.Children.Add(label,0,0);
Grid.SetColumnSpan(label,2);
标签将跨越两列,有效地使该行仅包含一列