Created
September 15, 2014 08:35
-
-
Save prashantvc/5b9562e99ed8cc926914 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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