using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Xamarin.Forms.Controls.GalleryPages { public class LayoutPerformanceGallery : ContentPage { public LayoutPerformanceGallery () { int size = 3; var grid = new Grid { VerticalOptions = LayoutOptions.FillAndExpand, RowDefinitions = { new RowDefinition { Height = new GridLength (100, GridUnitType.Absolute) }, new RowDefinition { Height = new GridLength (5, GridUnitType.Star) }, new RowDefinition { Height = new GridLength (7, GridUnitType.Star) }, }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (100, GridUnitType.Absolute) }, new ColumnDefinition { Width = new GridLength (7, GridUnitType.Star) }, } }; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { var g = new Grid { RowDefinitions = { new RowDefinition { Height = new GridLength (100, GridUnitType.Absolute) }, new RowDefinition { Height = new GridLength (5, GridUnitType.Star) }, new RowDefinition { Height = new GridLength (7, GridUnitType.Star) }, }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength (3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength (100, GridUnitType.Absolute) }, new ColumnDefinition { Width = new GridLength (7, GridUnitType.Star) }, } }; for (int k = 0; k < size; k++) { for (int l = 0; l < size; l++) { var label = new Label { Text = "10" }; g.Children.Add (label, k, l); _labelList.Add (label); } } grid.Children.Add (g, i, j); } } Content = new StackLayout { Children = { (_mainLabel = new Label ()), grid } }; } Label _mainLabel = null; List