1
votes

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

2
What's the result from the navigation? Exception?Haukinger
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
What is the result of await NavigateAsync(...)?Haukinger
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
@Haukinger Did you mean to ask which page it navigates to ?Tanmay Kanekar

2 Answers

2
votes

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
1
votes

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!