Swathy
Swathy

Reputation: 219

How to hide the tab bar navigation header in xamarin forms ios

I have an application with 8 tab bar, am using custom navigation bar for all pages.In ios while clicking the item from the more tab, the tab bar title is coming as navigation bar header, how to hide that navigation bar header.

I have added the below code in TabbedPage and Page1 Xaml pages. It is working for upto 4 tabs. But when clicks on more tab item , header is coming.

NavigationPage.HasNavigationBar=False;
NavigationPage.HasBackButton="False";

Here is the code I used for adding tabbed pages.

public TabbedPage1()
    {
        InitializeComponent();
       
        for(int i = 1; i <= 8; i++)
        {
            Page _page = null;
            _page = new Page1();
            _page.Title = "Class" + i.ToString();
            Children.Add(_page);

        }
    }

This is the

I want to remove the Class 7 heading and need to place the heading after the navigation bar.

Upvotes: 0

Views: 889

Answers (1)

ColeX
ColeX

Reputation: 14475

Don't place TabbedPage inside NavigationPage , it's not a good design.

Correct way : set TabbedPage as MainPage and wrap the children pages inside NavigationPage.

App

public App()
{
   InitializeComponent();

   //MainPage = new NavigationPage( new TabbedPage1());  //don't use this way

   MainPage = new TabbedPage1();
}

TabbedPage

public TabbedPage1()
{
   InitializeComponent();

   for (int i = 1; i <= 8; i++)
   {      
     Page _page = null;
     _page = new Page1();
     _page.Title = "Class" + i.ToString();

     NavigationPage navi = new NavigationPage(_page);
     navi.Title = "Page" + i.ToString();
     Children.Add(navi);

   }
}

Upvotes: 0

Related Questions