Nicolas Guerin
Nicolas Guerin

Reputation: 366

Hide header Tabbed Navigation Page Xamarin/FreshMvvm

I'm struggling with hiding the header of my TabbedNavigation Page.

    public class NavigationContainerNames
{
    public const string AuthenticationContainer = "AuthenticationContainer";
    public const string MainContainer = "MainContainer";
}

public partial class App : Xamarin.Forms.Application
{
    public App()
    {
        InitializeComponent();

        var maintTabNav = new FreshTabbedFONavigationContainer("Aerogrow", NavigationContainerNames.MainContainer);
        maintTabNav.FirstTabbedPage.On<Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);

        maintTabNav.AddTab<AerogrowPageModel>("Aerogrow", "");
        maintTabNav.AddTab<ControlsPageModel>("Controls", "");
        maintTabNav.AddTab<AccountPageModel>("Account", "");

        var LoginPage = FreshPageModelResolver.ResolvePageModel<RegisterPageModel>();
        var LoginNav = new FreshNavigationContainer(LoginPage, NavigationContainerNames.AuthenticationContainer);

        if (DataHelpers.DataBaseHelpers.GetCurrentUser() != null)
            MainPage = maintTabNav;
        else
            MainPage = LoginNav;
    }

I create my FreshTabbed Navigation Page and add the children in it but there's is a common header in every tab that I can't hide (with "Aerogrow" written).

If someone knows how to hide it please :)

note: I've tried to hide trough XAML but it doesn't work

NavigationPage.HasNavigationBar="false"

Here is is the header

Upvotes: 1

Views: 933

Answers (1)

Ax1le
Ax1le

Reputation: 6643

Hide the first tabbed page's navigation bar via:

var maintTabNav = new FreshTabbedFONavigationContainer("Aerogrow", NavigationContainerNames.MainContainer);
maintTabNav.FirstTabbedPage.On<Xamarin.Forms.PlatformConfiguration.Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
NavigationPage.SetHasNavigationBar(maintTabNav.FirstTabbedPage, false);

If you don't want to see the navigation bar on each page make your page inherit from a base page. Then set the property in the base page:

public class BasePage : ContentPage
{
    public BasePage()
    {
        NavigationPage.SetHasNavigationBar(this, false);
    }
}

Upvotes: 3

Related Questions