How to customize content page on tab in XAML in Xamarin?

I want to set up a tab with three content pages, which are pages 1, page 2 and page 3, all of them are content pages. When the program starts, I want to show the page with page1 pages with the page1 tab. They do not correspond to the model of element templates, since they are all different content pages compared to the example displayed on the tabbed page. Example: xamarian.

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

What property should I set here so that I can point to the contents of the linked content page or fire the select select event and manually call the corresponding content page? I would like to try to do this with XAML as much as possible. Thanks

+8
xamarin xamarin.forms
source share
1 answer

Found an answer here just in case, looking for the same question. In my case, I was able to do this in the code behind, but you can do the same in XAML, as the message says. One more thing: when you add a content page to a tab element, and if you want to add a title and icon to it, then you can reference the index of the child element, 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" 
+11
source share

All Articles