Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

(the ever popular) Xamarin.Forms TabbedPage navigation question

$
0
0

Hi,

I defined a TabbedPage as shown below. I would like to find out how I can navigate from the different tab child pages (e.g. MainMenuPage which is a NavigationPage) to other child pages (NavigationPages that get pushed on the stack) while keeping the TabbedPage tab bar visible.

I tried this statement but on Android I get an error message that PushAsync is not supported on all platforms.
NavigationPage mainPage = (NavigationPage)Application.Current.MainPage;
await mainPage.Navigation.PushAsync(navPage);

Any suggestions greatly appreciated.

Thanks!

<?xml version="1.0" encoding="UTF-8"?>
<TabbedPage
    x:Class="MainTabPage">
  <TabbedPage.Children Padding="0">
  </TabbedPage.Children>
</TabbedPage>          


   public partial class MainTabPage : TabbedPage
    {
        public MainTabPage()
        {
            InitializeComponent();

            // Hide Tab Page Navigation Bar
            NavigationPage.SetHasNavigationBar(this, false);

            // Add Tabs:
           var mainMenuPage = NavigationService.BuildPage(AppPage.MainMenuPage);
            this.Children.Add(mainMenuPage);

            // Guide Page
            var guidePage = NavigationService.BuildPage(AppPage.GuidePage);
            this.Children.Add(guidePage)
        }
    }           


    public partial class App : Application
    {
        public App()
        {
            InitializeComponent();

            // Open the main menu
            var page = new MainTabPage();

            MainPage = page;
        }   
    }

Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>