TabbedPage is not working for me

Steve M 96 Reputation points
2021-03-28T17:54:44.717+00:00

Hi,

I am following a tutorial where I create a tabbed page:

<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
            xmlns:local="clr-namespace:TravelRecordApp"
            x:Class="TravelRecordApp.HomePage">


</TabbedPage>

When I try to access other pages I am only able to access my MainPage created with the project.
The other XAML contentpages I have added are not showing up for me to select.

I can only see the following:

<local:MainPage/>

The tutorial shows that you should be able to reference any other pages that are added to the project since they are under the same namespace. The local name references the project namespace so it should see the other pages. Not sure what's missing or where I am making a mistake.

Any help is appreciated!

Thank you.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,291 questions
0 comments No comments
{count} votes

Accepted answer
  1. Steve M 96 Reputation points
    2021-04-05T04:33:36.817+00:00

    Thanks Leon, but a simple update and restart of macbook pro did the trick. I made no changes in the project and now it's working. Really weird though.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 68,016 Reputation points Microsoft Vendor
    2021-03-29T01:43:13.353+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    Firstly, please open your App.xaml.cs, set the MainPage to HomePage

       public App()  
               {  
                   InitializeComponent();  
         
                   MainPage = new HomePage();  
               }  
    

    Then, add Title for your ContentPage. For example, I have ContentPage called Page1, I add title in the XAML.

       <?xml version="1.0" encoding="utf-8" ?>  
       <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"  
                    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"  
                    x:Class="TabbedPageDemo.Page1"   
                    Title="Page1">  
           <ContentPage.Content>  
               <StackLayout>  
                   <Label Text="Welcome to Xamarin.Forms!"  
                       VerticalOptions="CenterAndExpand"   
                       HorizontalOptions="CenterAndExpand" />  
               </StackLayout>  
           </ContentPage.Content>  
       </ContentPage>  
    

    Then make sure, you add the new page in the root path of your MainPage.

    Here is my demo running screenshot.

    82134-image.png

    Best Regards,

    Leon Lu


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.