简体   繁体   中英

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()))

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 ();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM