MasterDetail page closes after second detail page is pushed #2552
Unanswered
dzebas
asked this question in
Xamarin.Forms
Replies: 1 comment 1 reply
-
Start here: https://prismlibrary.com/docs/xamarin-forms/navigation/working-with-masterdetailpages.html |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I've MasterDetail page (not a root MainPage) which is pushed modally like this:
navigationService.NavigateAsync( "ObjectMasterDetailPage/NavigationPage/BlankPage", navigationParameters, true );
In the master I display a list and when row is tapped I push detail page like this (not modally):
navigationService.NavigateAsync( "NavigationPage/JobPage", navigationService, navigationParams, false);
Everything works fine, JobPage gets pushed, I see hamburger menu and all the buttons in JobPage navigation etc.
Now when I select another row and call the same code to push new job page, master/detail page simply closes. I can't understand what is happening? Is this expected and I'm not using master/detail correctly?
Edit: after digging deeper I've found that when I call to navigate to JobPage for second time, for some reason InitializeAsync is called on ObjectMasterDetailPage again? But this time parameters are for Job page, so it throws exception.
Any idea why would calling
navigationService.NavigateAsync( "NavigationPage/JobPage", navigationService, navigationParams, false);
for second time would call InitializeAsync on MasterDetail page?
Edit 2: more observations. I've reproduced same behaviour in Prism "09-MasterDetail" demo. If I push View A, then View B, Initialize in MasterDetail won't be called and also Destroy method is called in View A. If I push View A and then push View A again, Initialize is called in MasterDetail and Destroy is not called in View A.
Is this by design? In my case in Master page I've a list of similar objects. but with different data. Does this mean that instead of pushing same view again I should instead reload it? Or is this simply a bug?
Beta Was this translation helpful? Give feedback.
All reactions