Skip to content

Instantly share code, notes, and snippets.

@saamerm
Last active June 29, 2016 20:08
Show Gist options
  • Save saamerm/28d5436684b6f5d9716b370cf95a9a36 to your computer and use it in GitHub Desktop.
Save saamerm/28d5436684b6f5d9716b370cf95a9a36 to your computer and use it in GitHub Desktop.
This gist was made with the help of Nicholas Johnson to enable the ContentPage tutorial from Xamarin.com to work https://developer.xamarin.com/api/type/Xamarin.Forms.ContentPage/
//ContentPage Tutorial
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xamarin.Forms;
namespace App6
{
public class App : Application
{
public App()
{
MainPage = GetMainPage();
}
public static Page GetMainPage()
{
return new ContentPage
{
Content = new Label
{
Text = "First Way!",
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.CenterAndExpand,
},
};
//Anonymous or Inline
//var mypage = new ContentPage()
//{
// Content = new Label
// {
// Text = "Second Way!",
// VerticalOptions = LayoutOptions.CenterAndExpand,
// HorizontalOptions = LayoutOptions.CenterAndExpand,
// }
//};
//return mypage;
//We can't modify it afterwards if we wanted.
//var mypage = new ContentPage();
//mypage.Content = new Label
//{
// Text = "Third Way!",
// VerticalOptions = LayoutOptions.CenterAndExpand,
// HorizontalOptions = LayoutOptions.CenterAndExpand,
//};
//return mypage;
////We will still have access to it and the data is modifiable, preferrably for buttons
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment