user6742877
user6742877

Reputation:

Hiding TabBar in some page in Xamarin Forms

I have this code in Xamarin Forms:

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

       var playPage = new NavigationPage(new PlayPage())
       {
          Title = "Play",
          Icon = "play1.png"
       };
       var settingsPage = new NavigationPage(new SettingsPage())
       { 
          Title = "Settings",
          Icon = "settings.png"
        };
        var aboutPage = new NavigationPage(new AboutPage())
        {
           Title = "About",
           Icon = "about.png"
        };
        Children.Add(playPage);
        Children.Add(settingsPage);
        Children.Add(aboutPage);
    }

In AboutPage I have an event that open another ContentPage (HelpPage) using Navigation.PushAsync. Is it possible to hide the tab bar while I'm inside the HelpPage in Xamarin.Forms without hiding the navigation bar?

Upvotes: 2

Views: 2917

Answers (1)

Kevin Le - Khnle
Kevin Le - Khnle

Reputation: 10887

Yes, you can do the following:

var page = new NavigationPage(new HelpPage());
await Application.Current.MainPage.Navigation.PushModalAsync(page, true);

This will create a modal page which will cover the tab bar.

In the HelpPage, have a "Close" button or toolbar item which will call Navigation.PopModalAsync()

Upvotes: 1

Related Questions