1

I have implemented MasterDetail Page using xamarin forms prism and I have following Pages in my app. 1) Master 2) Home 3) Employee 4) Profile

-- Initially App is set to Master - Home (Detail Page) page after login. From Home page i navigate to Employee (Detail Page) using code as follows :

  await _navigationService.NavigateAsync("NavigationPage/Employee");

-- From Employee Page I navigate to Profile (Content Page - Non Detail page) by clicking on one of the employees using code:

 await _navigationService.NavigateAsync("Profile", lstparam, null, false);

-- Once home button is clicked in profile page, i want to navigate to Master - Home (Detail Page) . However it navigates to Employee (Detail Page) .

await _navigationService.GoBackToRootAsync();

Checked navigation stack by debugging , It was only showing Employee (Detail Page) Page in it. Also tried navigation to home page by using following code :

await NavigationService.NavigateAsync("/Master/NavigationPage/Home");

The above code is working and i can navigate to Home (Detail Page) , but I am getting White Screen while navigating to Profile to Home Page .

Attached Screenshots . Please Help .Thanks in Advance.

MasterPage

Details_Home

Details_Employee

Profile

Whitescreen

  • What's the result from the navigation? Exception? – Haukinger Feb 07 '19 at 06:22
  • No . I dont get any exception . The code await NavigationService.NavigateAsync("/Master/NavigationPage/Home"); actually works. But it displays white screen for a moment during transition from profile to home page and then navigates to home page. I think its because of pushing multiple pages i.e. "/Master/NavigationPage/Home" at a time in navigation stack . Pushing employee and profile pages works fine for me without any white screen issue. – Tanmay Kanekar Feb 07 '19 at 06:57
  • What is the result of `await NavigateAsync(...)`? – Haukinger Feb 07 '19 at 07:34
  • I have a similar issue, with NavigationPage (PushAsync), it seems during a transiation the target page is loaded also async and as long it is not loaded yet you see a blank page. There seems to be no solution at the moment. I could only figure out to set the background color of the blank page. On faster devices i do not recognize this transiation. – veeman Feb 07 '19 at 08:10
  • @Haukinger Did you mean to ask which page it navigates to ? – Tanmay Kanekar Feb 07 '19 at 09:36
  • @TanmayKanekar I mean "what is `INavigationResult.Success` and what is `INavigationResult.Exception`?" on the navigation result returned by `NavigateAsync` – Haukinger Feb 07 '19 at 11:46
  • @Haukinger I tried debugging Prism.Navigation.INavigationService _navigationService object in _navigationService.NavigateAsync("/...") but could not find INavigationResult.Success and INavigationResult.Exception and also tried to check navigation result returned by NavigateAsync as you suggested but found that _navigationService.NavigateAsync("/...") is a void method which does not return Error and success in navigation . Is there any workaround for navigating to Home (Detail Page) from Profile (Content page) without encountering white screen issue. – Tanmay Kanekar Feb 15 '19 at 05:19
  • How exactly are you `await`ing a `void` method? – Haukinger Feb 15 '19 at 07:49
  • Are you using `Shell`: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/shell/flyout ? – lolelo Jun 26 '19 at 11:46

2 Answers2

3

I recently had a very similar problem but it did not depend on prism. I wanted to create an autologin features by bypassing the login (ContentPage) and calling the homepage (Master And Detail Page). To do this I had to call the async login service method in my application class. in order:

  1. Call async service
  2. Call NavigationService.NavigateAsync

In this case appears a blank page

To Solve:

  1. Call NavigationService.NavigateAsync
  2. Call async service
alberto basoli
  • 286
  • 2
  • 9
1

In my case, it happened to me for being using the wrong NavigationService.
I had a static Navigator class that I've been using it for managing and Logging navigations in the App (a simple wrapper), which has a property called Instance, of type NavigationService that I was setting it to the NavigationService of the App.xaml.cs

Reassigning it on each ViewModel (in the ViewModelBase's constructor) fixed the white page bug for me.
Hope it helps someone!

Dr TJ
  • 3,241
  • 2
  • 35
  • 51