question

JanDuldhardt-0002 avatar image
0 Votes"
JanDuldhardt-0002 asked ·

How to hide UWP Navigationbar

For Android and iOS the following code works:

NavigationPage.HasNavigationBar="False"

But this does not work for UWP. Is there any workaround / custom renderer to hide the NavigationBar completely in UWP?93804-uwpnavigationbar.png


I am talking about the bar marked with a red "1"

windows-uwp
· 4
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@JanDuldhardt-0002 The code works well for me. Could you please tell me what template you used to develop your app? There might be differences in our apps, I suggest that you could refer to my steps to do this.
1.create a new mobile app and select the Blank template, then develop for the Windows(UWP).
2.create a new Content Page named Page1 and use MainPage = new NavigationPage(new Page1()); in app constructor, then set NavigationPage.HasNavigationBar="False" in xaml page of page1.



0 Votes 0 ·

The result is as follows:
93847-555.jpg


0 Votes 0 ·
555.jpg (19.0 KiB)

Yes works for page 1 but not for page 2, after you navigate from page 1 to page 2. And if I navigate back from page 2 to page 1 the navigationbar is shown again.

0 Votes 0 ·
AryaDing-MSFT avatar image AryaDing-MSFT JanDuldhardt-0002 ·

@JanDuldhardt-0002 Based on my origin app, I added a button to the XAML page of Page1 and edited the click event, as follows:

  private async void Button_Clicked(object sender, EventArgs e)
         {
             var nextPage = new Page2();
               
             await this.Navigation.PushAsync(nextPage);
         }

Then I set NavigationPage.HasNavigationBar="False" in xaml page of page2. It still works well.
When I navigate back from page 2 to page 1, the navigationbar doesn't appear.

0 Votes 0 ·

0 Answers