10
votes

I want to setup a tabbed page with three content pages they are page1, page2 and page3 all of them are content pages. When the program starts I want to show page1 content page with page1 tab selected. They do not follow item template model since they are all different content pages compared to the example showing in the Tabbed Page example @ xamarian.

<TabbedPage.Children>
    <ContentPage Title="Page 1" />
    <ContentPage Title="Page 2" />
    <ContentPage Title="Page 3" />
</TabbedPage.Children>

What property I should set here so that I can point to the content of the associated content page or do I follow tab selecte event and manually call the appropriate content page? I would like to try to do it with XAML as much as possible. Thanks

1

1 Answers

13
votes

Found the answer here just in case looking for the same question. In my case, I was able to do it in the code behind, but you can do the same in XAML as the post says. One additional thing is, when you add a content page to a tab item and if you want to add title and Icon to it, then you can reference the index of the child and you can set them manually as .Tile and .Icon.

this.Children.Add( new Page1 ());
this.Children[0].Title = "Page 1";
this.Children[1].Icon = "page1.png"