0

I'm following this guide (https://15mgm15.ghost.io/2018/06/06/bottom-tabbed-page-for-xamarin-forms-android/) but I cant figure out how to add the pages I've added to the project.

I need to add something here in order for the app to understand which pages are to be shown:

<TabbedPage
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local="clr-namespace:bottom"
    x:Class="bottom.MainPage">
    <TabbedPage.Children>
        <ContentPage Title="Page 1" Icon="death_star.png"/>
        <ContentPage Title="Page 2" Icon="green_star.png"/>
        <ContentPage Title="Page 3" Icon="star.png"/>
    </TabbedPage.Children>
</TabbedPage>

Right now, It is only showing the tabbed page since it doesnt know which pages to get info from.

KalleP
  • 319
  • 4
  • 16

1 Answers1

0

Strongly recommend that you read the official docs: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/navigation/tabbed-page

If you are attempting to add an existing XAML page to the tabbed page, you would need to replace each ContentPage element in your code above with the pages you want.

eg if you had a page called "MyTestPage"

<TabbedPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:bottom"
x:Class="bottom.MainPage">
<TabbedPage.Children>
    <MyTestPage Title="Page 1" Icon="death_star.png"/>
    <ContentPage Title="Page 2" Icon="green_star.png"/>
    <ContentPage Title="Page 3" Icon="star.png"/>
</TabbedPage.Children>

App Pack
  • 1,512
  • 10
  • 9
  • Thanks for help but that gives this error: "Object reference not set to an instance of an object.". @App Pack – KalleP Jul 10 '18 at 08:45
  • 1
    You need to use `` instead of `` – MShah Jul 10 '18 at 09:10
  • @KalleP Please write try-catch for intializeComponent() in your xaml.cs file of this page and place debug point on catch, then see the exception, it will have more detail.If you provide that detail I may help you further. – MShah Jul 10 '18 at 09:44
  • I hope you have resolved your issue @KalleP , if yes then you should provide the solution as an answer. – MShah Jul 10 '18 at 12:46