1

Here is my scenario:

My app starts with opening a MasterDetailPage. The Master is a StackLayout of Button that just open a specific DetailPage. You can see this as some kind of video library with a Menu...

I want the hamburger menu to be available so the user can access the Master anytime and switch between videos.

I am using Prism 7.2, so the first navigation is set up this way in the App.xaml.cs file:

await NavigationService.NavigateAsync("MasterPage/NavigationPage/MainPage");

But then I want to avoid the possibility to navigate back after hitting a specific page. For me it makes no sens in this context for the user to go back to the Master this way. He should use the hamburger menu. So in that case, when hitting the back button, the app should just exit. To accomplish that I thought about rewriting the entire stack when I navigate to a DetailPage:

// Where page parameter is like "MasterPage/NavigationPage/VideoPage?...."
private async Task NavigateCommandAsync(string page)
{
    await NavigationService.NavigateAsync("myapp:///" + page);


    // Some of the things I've tried...
    //await NavigationService.GoBackAsync();
    //await NavigationService.NavigateAsync(page);

    //await NavigationService.NavigateAsync(new Uri(page, UriKind.Relative));
}

At least this way, when the user clicks the back button, it just exits the app which is what I wanted.

So far so good in therms of behavior. Except that I started to notice a white page binking before showing any DetailView. At the end, I've clearly understood that it was the NavigationPage that was shown for <1s. But this is annoying from a user experience point of view. Also I was able to change the BackgroundColor of this page so it looks less ugly but it's still not optimal...

Now I've tried many changes in therms of pushing the DetailPage but then the behavior is obviously not the same. So far I've understood, I need to wrap anyway the detail page in a NavigationPage in order to get the hamburger menu. But then this NavigationPage is binking all around. If I remove it, I lose the hamburger menu.

Is there any possible workaround for such a case using a MasterDetailPage? Or any idea of what am I doing wrong or misunderstood?

TaiT's
  • 3,138
  • 3
  • 15
  • 26

0 Answers0