Skip to content

Instantly share code, notes, and snippets.

@prashantvc
Created September 4, 2014 14:43
Show Gist options
  • Save prashantvc/a36049804beff2bff7c9 to your computer and use it in GitHub Desktop.
Save prashantvc/a36049804beff2bff7c9 to your computer and use it in GitHub Desktop.
using System;
using Xamarin.Forms;
namespace TheGridTest
{
public class App
{
public static Page GetMainPage ()
{
Grid grid = new Grid
{
Padding = 50,
VerticalOptions = LayoutOptions.FillAndExpand,
HorizontalOptions = LayoutOptions.FillAndExpand,
RowDefinitions =
{
new RowDefinition { Height = new GridLength(100, GridUnitType.Absolute) },
new RowDefinition { Height = new GridLength(100, GridUnitType.Absolute) }
},
ColumnDefinitions =
{
new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) },
new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }
},
RowSpacing = 15
};
var lbl1 = new Label {
Text = "One"
};
var lbl2 = new Label {
Text = "Two",
VerticalOptions = LayoutOptions.Center
};
var lbl3 = new Label {
Text = "Three"
};
var lbl4 = new Label {
VerticalOptions = LayoutOptions.End,
Text = "Four"
};
grid.Children.Add (lbl1, 0, 0);
grid.Children.Add (lbl2, 1, 0);
grid.Children.Add (lbl3, 0, 1);
grid.Children.Add (lbl4, 1, 1);
return new ContentPage {
Content = grid
};
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment