Complex page workflows can become a burden unless you separate the workflows into different stacks. The most common page workflow you will encounter is the Authentication and Main App workflow. Why do we separate these? The authentication workflow (the login page or register page) shouldn’t be accessible from the main application and the main application shouldn’t be accessible from the authentication pages.
When doing the login stack, they are recommendations to use the ModalStack for this. Xamarin Forms has 2 types of navigation stacks in a navigation page. Navigation and Modal. There is nothing different about them except they are completely separate navigation stacks within the same NavigationPage. However I never recommend this approach due to the page flickering issue and this depends on which way you load your pages.
So when you load a page the Main screen shows first, then quickly loads the (Modal) Login screen and you see that page flicker. Its not a nice feel to the app.
If you run separate NavigationPage’s you don’t have that issue. You can pre load any navigation pages in the background and only show the applicable NavigationPage at any time. The added benefit is you can be deep in one NavigationPage, switch to another, then jump right back in to where you left off with this approach. You can then even jump right back into the other workflow.
Create a Stack
I call these Stacks in my setup and they are a contained way to setup a Navigation Stack. In the stacks you
- Map Key’s to Pages (for the navigation service)
- Map ViewModels to Pages (for binding to pages)
- Starting Page
- Initialize the Navigation Page (and/or MasterDetailPage if applicable)