Prism Navigation keep MasterPageDetail menu after navigating to other page

433 Views Asked by At

I'm using prism and had a MasterDetailPage with some pages that is accessible from that. But, in some of this pages, I can navigate to other pages that is not accessible from the MasterPageDetail Menu, but menu is still accessible with sliding action. I'll post some prints to try explain.

That's is a page that is accessible from MasterPageDetailMenu First page

When the user is accessing this page, he can access the MasterPageDetail Menu. But if the user select an item of the list or click in "Plus" Floating Button, the app navigate to other Page where MasterPageDetail Menu shouldn't be accessible.

Second Page - Menu shouldn't be accessible

But, as you can see on the next image, if the user slide the page from the left to right, the MasterPageDetail Menu is still accessible

Second page with menu accessible

How can I avoid this behaviour? In the App class, my code for navigate to MasterPageDetail is:

await NavigationService.NavigateAsync("Menu/Navigation/TipoItensCardapio")

In this case, menu is my MasterPagelDetail. The code for navigate from TipoItensCardapio page to the second page is:

NavigationService.NavigateAsync("TipoItemCardapioEdit");
1

There are 1 best solutions below

1
Nick Peppers On

If you intend for a specific page to not allow the drawer to be swiped out it sounds like you should probably be pushing it as a Modal instead of a normal Page. For example:

await Navigation.PushModalAsync(new YourPage());

For more info about Xamarin.Forms modals I'd check out the docs