Elliot ChingLee Elliot ChingLee - 1 month ago 14
C# Question

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);
}
}

Answer

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