I chose a Master Detail Page as main page. My detail pages are content pages.
If the user is on the first/start page and clicks a button, another page will be pushed via Navigation.PushAsync(). On this page, normally the back button will be shown. But I don't need the back button there. I need the navigation icon to open the menu.
How can I do this? I just know that I can dispose th back button..
Setting NavigationPage.HasNavigationBar to true doesn't change anything..
And how can I prevent the users from clicking the back button from their smartphone?
Ahh, that's a different scenario. You you want to change your detail page from a current detail page in memory you need to notify the master page/viewmodel to change the detail page.
One approach is to use message center to message the masterdetail page from the detail page to change
Answers
In your masterdetail page in button click event write below code
I have this code already, but it doesn't work..
Any other suggestions?
@tschennie
The MasterDetail hamburger behavior is strange, in your scenario you do a navigation from your detail page, the hamburger will disappear in android and a back button will be shown but you can still swipe right and get at the Master page, in iOS it behaves differently
We push a modal page is you want to handle the user trying to navigate back. It's not ideal but MasterDetail has some limitations.
try this code
NavigationPage.HasNavigationBar = true
NavigationPage.HasBackButton = False
i believe it will work
@NMackay
So, is there a possibility to navigate/show another page instead of pushing? Or set another page as detail page?
You can always change the detail page. Look at this.
Hope this helps
@Gigex42
I mean changing the detail page when I'm on another page and not from the main page..
So when the user is on the last page, he shouldnt be able to go back to the previous page? Because the backbutton of the navigationpage wont be your only problem then because of the hardware back button.
I dont know if this works but could you pop the previous page from the navigation stack?
@tschennie
Ahh, that's a different scenario. You you want to change your detail page from a current detail page in memory you need to notify the master page/viewmodel to change the detail page.
One approach is to use message center to message the masterdetail page from the detail page to change
@tschennie Did you find a solution to this ? I am also facing the same problem in one of my app
@tschennie - This should have served your purpose.
This became issue for me. I want back arrow after pushing first
Page
. How you was pushing firstContentPage
w/o using above code or by usingPushAsync
. Thank you.back navigation button doesn't work for my modal navigation pages in xamarin forms .any one have idea?