Skip to content

Instantly share code, notes, and snippets.

@kirtisagar
Forked from prashantvc/TabPageTestCase.cs
Last active May 7, 2016 08:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kirtisagar/ade2a207d759f4ab800c to your computer and use it in GitHub Desktop.
Save kirtisagar/ade2a207d759f4ab800c to your computer and use it in GitHub Desktop.
fixed the tabbed page
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 ());
var myPages = new NamedColor[]
{
new NamedColor("Red"),
new NamedColor("Yellow"),
new NamedColor("Green"),
new NamedColor("Aqua"),
new NamedColor("Blue"),
new NamedColor("Purple"),
new NamedColor("Olive")
};
foreach (var item in myPages)
{
this.Children.Add(new TabPage() { BindingContext = item });
}
}
}
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;
}
}
}
@kirtisagar
Copy link
Author

fixed the tabbed page more button issue in iOS

@tikotal
Copy link

tikotal commented May 7, 2016

Crazy, this bug is still there, the official Demo is still not functioning (Demo) and there is no answer on why or when will it be fixed! (Forum)

kirtisagar - thanks for the workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment