user1818298
user1818298

Reputation: 569

Xamarin.Forms - How to navigate to a tabbed page child page

I'm still fairly new to Xamarin.Forms and app building in general so please be gentle.

Currently I'm using a Tabbed Page to handle my main navigation and I have 3 tabs as soon as the user logs in. One of the tabs is called "AccountPage". From the account page you can go to a profile page and update profile information. After the user finishes updating profile information and saving I currently do a Navigation.PushAsync back to the account page.

What I'm wanting to do is actually have it navigate back to the main tabbed page but show the account child page...if that makes sense. Basically I want the account page to display but to also have the tabs displayed for navigation (which it currently doesn't since I'm just navigating directly to the account page).

Is there a way to navigate to a tabbed page child? Something like

Navigation.PushAsync(new TabbedPage().Child(new AccountPage()))

Upvotes: 0

Views: 5219

Answers (1)

Jessie Zhang -MSFT
Jessie Zhang -MSFT

Reputation: 13803

If I understand correctly, you can wrap the tabbed child page into NavigationPage,for example:

<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:TabbedPageWithNavigationPage;assembly=TabbedPageWithNavigationPage" x:Class="TabbedPageWithNavigationPage.MainPage">
  <NavigationPage Title="Schedule" IconImageSource="schedule.png">
    <x:Arguments>
        <local:AccountPage />
    </x:Arguments>
  </NavigationPage>
  <local:TodayPage />
  <local:SettingsPage />
</TabbedPage>

Then you can go to page ProfilePage by following code:

await Navigation.PushAsync (new ProfilePage());

And come back to AccountPage by using code:

 await Navigation.PopAsync ();

Upvotes: 2

Related Questions