Skip to content

Instantly share code, notes, and snippets.

@prashantvc
Created September 15, 2014 08:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save prashantvc/5b9562e99ed8cc926914 to your computer and use it in GitHub Desktop.
Save prashantvc/5b9562e99ed8cc926914 to your computer and use it in GitHub Desktop.
using Xamarin.Forms;
namespace TabPageTestCase
{
public class App
{
public static Page GetMainPage ()
{
return new TabbedDemoPage ();
}
}
public class TabbedDemoPage : TabbedPage
{
public TabbedDemoPage ()
{
Title = "TabbedPage";
this.ItemsSource = new NamedColor[] {
new NamedColor ("Red"),
new NamedColor ("Yellow"),
new NamedColor ("Green"),
new NamedColor ("Aqua"),
new NamedColor ("Blue"),
new NamedColor ("Purple"),
new NamedColor ("Olive")
};
ItemTemplate = new DataTemplate (() => new TabPage ());
}
}
public class NamedColor
{
public string Name {
get;
set;
}
public NamedColor (string name)
{
Name = name;
}
}
public class TabPage : ContentPage
{
readonly Label myLabel;
public TabPage ()
{
myLabel = new Label {
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.CenterAndExpand,
};
myLabel.SetBinding (Label.TextProperty, "Name");
this.SetBinding (Page.TitleProperty, "Name");
Content = myLabel;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment