elliotching
elliotching

Reputation: 1092

Xamarin.Forms (WinPhone) Hide the Title space NavigationBar for Xamarin.Forms.NavigationPage. Please

In App.cs, when I set the Main page = new MyContentPage(). It is doing good. However, I have to do Navigation.PushAsync(somePage()), so when I changed Main page = new NavigationPage(new MyContentPage()) it comes out with a huge title space, which I don't want that. Please help me to hide that. Thanks.


UPDATE:
I've tried NavigationPage.SetHasNavigationBar(this, false) is not working to me. Can I know which version of Xamarin.Forms is working for SetHasNavigationBar(this, false) ? I've tried both Xamarin.Forms 2.0 and the latest 2.3 and they are both seem not responsive to WinPhone.
Is there anyway I can modified it in WinPhone Independent API?

My code:

public class App : Application
{
    public App()
    {
        NavigationPage.SetHasNavigationBar(this, false);
        MainPage = new NavigationPage(new CP());
        NavigationPage.SetHasNavigationBar(this, false);
    }
}

Upvotes: 0

Views: 443

Answers (2)

elliotching
elliotching

Reputation: 1092

OK, Solved. Sorry for my weak understanding.

Should be:

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

Upvotes: 0

user4717662
user4717662

Reputation:

You can remove the title bar of your NavigationPage by calling: NavigationPage.SetHasNavigationBar(this, false);

Upvotes: 0

Related Questions