Navigation can be performed by specifying a valid absolute URI as an argument to the GoToAsync method: await ("//animals/monkeys") The current navigation state of the Shell object can be retrieved through the property, which includes the URI of the displayed route in the Location property. However, when a page that's not in the Shell visual hierarchy is navigated to, a navigation stack is created.
![shell minicom type shell minicom type](https://img-lib.wm-help.net/2818274221/i_075.png)
When a route from the Shell visual hierarchy is navigated to, a navigation stack isn't created. The routes for such pages are known as global routes. These detail pages can then be navigated to using URI-based navigation, from anywhere within the application.
![shell minicom type shell minicom type](https://static.wixstatic.com/media/3b5532_e8d22d52e69c4b509bf42f9991c1414c~mv2.png)
This example registers detail pages, that aren't defined in the Shell subclass, as routes. Routing.RegisterRoute("elephantdetails", typeof(ElephantDetailPage)) Routing.RegisterRoute("dogdetails", typeof(DogDetailPage)) Routing.RegisterRoute("catdetails", typeof(CatDetailPage)) Routing.RegisterRoute("beardetails", typeof(BearDetailPage)) This is accomplished with the Routing.RegisterRoute method: Routing.RegisterRoute("monkeydetails", typeof(MonkeyDetailPage)) In the Shell subclass constructor, or any other location that runs before a route is invoked, additional routes can be explicitly registered for any detail pages that aren't represented in the Shell visual hierarchy. This exception will also be thrown if two or more routes at the same level in the hierarchy share a route name. Routes can be defined on FlyoutItem, TabBar, Tab, and ShellContent objects, through their Route properties: Īn ArgumentException will be thrown on application startup if a duplicate route is detected. When a navigation URI includes all three components, the structure is: //route/page?queryParameters Register routes Query parameters are parameters that can be passed to the destination page while navigating. For example, a details page won't be defined in the Shell visual hierarchy, but can be pushed onto the navigation stack as required. Pages that don't exist in the Shell visual hierarchy can be pushed onto the navigation stack from anywhere within a Shell application. A route, which defines the path to content that exists as part of the Shell visual hierarchy.Navigation URIs can have three components: Navigation is performed in a Shell application by specifying a URI to navigate to. For more information, see Hierarchical Navigation. Navigation can still be performed between pages in a Shell application by using the Navigation property. When navigation is about to be performed, the Navigating event is fired, and the Navigated event is fired when navigation completes. Navigation is performed by invoking the GoToAsync method, from the Shell class.
![shell minicom type shell minicom type](http://ecx.images-amazon.com/images/I/81RSkjd7oyL._SL1500_.jpg)
The BackButtonBehavior, CurrentItem, and CurrentState properties are backed by BindableProperty objects, which means that these properties can be targets of data bindings. Current, of type Shell, a type-casted alias for.
![shell minicom type shell minicom type](https://www.oreilly.com/openbook/debian/book/figs/deb.1128.gif)
CurrentState, of type ShellNavigationState, the current navigation state of the Shell.CurrentPage, of type Page, the currently presented page.CurrentItem, of type ShellItem, the currently selected item.BackButtonBehavior, of type BackButtonBehavior, an attached property that defines the behavior of the back button.The Shell class defines the following navigation-related properties: In addition, it also provides the ability to navigate backwards without having to visit all of the pages on the navigation stack. Xamarin.Forms Shell includes a URI-based navigation experience that uses routes to navigate to any page in the application, without having to follow a set navigation hierarchy.