question

SteveM-5815 avatar image
0 Votes"
SteveM-5815 asked SteveM-5815 answered

TabbedPage is not working for me

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.





dotnet-xamarin
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SteveM-5815 avatar image
0 Votes"
SteveM-5815 answered

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LeonLu-MSFT avatar image
0 Votes"
LeonLu-MSFT answered LeonLu-MSFT commented

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.



image.png (14.5 KiB)
image.png (45.2 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@SteveM-5815 Did you try to above code? If it worked? If not, you can post a demo here.

0 Votes 0 ·