Xamarin.Forms Shell Quick Tip – Easy Back Navigation
Xamarin.Forms Shell introduced route based navigation to Xamarin.Forms applications to easily navigate through applications and also pass data through query properties. Sometimes in your application it is not always about navigating forward to pages, but it is about navigating backwards when your users perform an action. Another reason you may have to navigate backwards through the app is when you are using modal pages and there is no physical back button such as on an iPhone. So, let’s see how easy it is to enable this functionality in your app.
Xamarin.Forms Shell Back Navigation
With the launch of Xamarin.Forms 4.6 came a brand new way to navigate backwards and can be combined with query properties. To navigate backwards you can use the same navigation patterns you are used to in terminal or the command line with `..`. That is right, just use `..` and a page will be popped from the stack.
Want to go back multiple pages? No problem:
Want to go back a page and navigate to a different page? Shell has you covered:
With Query Properties
In our previous blog post we looked at how to pass data from page to page with query properties. The great part about this new back navigation is that you can combine them together with Xamarin.Forms Shell. You can easily pass data from the current page to the pervious page:
Additionally, you could pass data to other pages that are pushed onto the stack:
Just like that you can easily navigate back and forth from pages in your application with the new `..` functionality that is part of Xamarin.Forms Shell. To learn more about using Xamarin.Forms Shell in your application, checkout the full documentation.