简体   繁体   中英

White Screen Issue while navigating in Xamarin forms Prism MasterDetails Page

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

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

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM