{"id":47259,"date":"2020-06-26T09:53:16","date_gmt":"2020-06-26T16:53:16","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/xamarin\/?p=47259"},"modified":"2021-03-17T11:00:29","modified_gmt":"2021-03-17T18:00:29","slug":"xamarin-forms-shell-back-navigation","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/xamarin\/xamarin-forms-shell-back-navigation\/","title":{"rendered":"Xamarin.Forms Shell Quick Tip &#8211; Easy Back Navigation"},"content":{"rendered":"<p>Xamarin.Forms Shell introduced route based navigation to Xamarin.Forms applications to easily navigate through applications and also <a href=\"https:\/\/devblogs.microsoft.com\/xamarin\/xamarin-forms-shell-query-parameters?WT.mc_id=shellback-blog-jamont\">pass data through query properties<\/a>. 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\u2019s see how easy it is to enable this functionality in your app.<\/p>\n<p><center>\n  <img decoding=\"async\" width=\"540\" height=\"400\" src=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/06\/a-screenshot-of-a-cell-phone-description-automati.png\" class=\"wp-image-47402\" alt=\"A screenshot of a cell phone navigating backwards using Xamarin.Forms Shell\" srcset=\"https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/06\/a-screenshot-of-a-cell-phone-description-automati.png 540w, https:\/\/devblogs.microsoft.com\/xamarin\/wp-content\/uploads\/sites\/44\/2020\/06\/a-screenshot-of-a-cell-phone-description-automati-300x222.png 300w\" sizes=\"(max-width: 540px) 100vw, 540px\" \/>\n<\/center><\/p>\n<h2>Xamarin.Forms Shell Back Navigation<\/h2>\n<p>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 &#96;..&#96;. That is right, just use &#96;..&#96; and a page will be popped from the stack.<\/p>\n<pre><code>await Shell.Current.GoToAsync(\"..\");\n<\/code><\/pre>\n<p>Want to go back multiple pages? No problem:<\/p>\n<pre><code>await Shell.Current.GoToAsync(\"..\/..\");\n<\/code><\/pre>\n<p>Want to go back a page and navigate to a different page? Shell has you covered:<\/p>\n<pre><code>await Shell.Current.GoToAsync(\"..\/details\");\n<\/code><\/pre>\n<h2>With Query Properties<\/h2>\n<p>In our <a href=\"https:\/\/devblogs.microsoft.com\/xamarin\/xamarin-forms-shell-query-parameters?WT.mc_id=shellback-blog-jamont\">previous blog post<\/a> 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:<\/p>\n<pre><code>await Shell.Current.GoToAsync(\"..?id=25\");\n<\/code><\/pre>\n<p>Additionally, you could pass data to other pages that are pushed onto the stack:<\/p>\n<pre><code>await Shell.Current.GoToAsync(\"..\/details?id=Baboon\");\n<\/code><\/pre>\n<p>Just like that you can easily navigate back and forth from pages in your application with the new &#96;..&#96; functionality that is part of Xamarin.Forms Shell. To learn more about using Xamarin.Forms Shell in your application, checkout the full <a href=\"https:\/\/docs.microsoft.com\/xamarin\/xamarin-forms\/app-fundamentals\/shell?WT.mc_id=shellback-blog-jamont\">documentation<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Xamarin.Forms Shell simplifies your application architecture and your navigation! See how easy it is to navigate backwards and pass parameters with some new features recently added.<\/p>\n","protected":false},"author":544,"featured_media":47402,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2,1,367],"tags":[5427,23,16,9159],"class_list":["post-47259","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-developers","category-xamarin","category-xamarin-forms","tag-navigation","tag-shell","tag-xamarin-forms","tag-xamarin-forms-shell-quick-tip"],"acf":[],"blog_post_summary":"<p>Xamarin.Forms Shell simplifies your application architecture and your navigation! See how easy it is to navigate backwards and pass parameters with some new features recently added.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts\/47259","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/users\/544"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/comments?post=47259"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/posts\/47259\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/media\/47402"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/media?parent=47259"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/categories?post=47259"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/xamarin\/wp-json\/wp\/v2\/tags?post=47259"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}