Navigation Interfaces in Xamarin.Forms

Navigation in mobile apps is a key factor contributing to the usability of the app. Confusing navigation can quickly frustrate any user and lead to bad reviews. Mobile apps need to accommodate a lot of data and views with limited screen estate, unlike desktop apps where you can have multiple views on one screen. This presents a challenge for developers and designers to come up with elegant navigation interfaces.

Xamarin application developers often face this challenge. Thankfully, Xamarin Forms has robust out-of-the-box capabilities for making navigation easy across mobile platforms and devices.

Xamarin Forms provides a number of navigation experiences like Content Page, Master Detail Page, Navigation Page, Tabbed Page, Carousel Page and Modal Page. This gives developers plenty of options to choose from and build UIs that are easy to navigate. These options can be combined to build complex navigation interfaces.

The beauty of Xamarin Forms lies in its ability to adapt UIs depending on mobile platforms (Android, iOS or Windows Phone). Using the same code-base you can get native-looking navigation elements on all three platforms. Let's take a look at an example.

Tabbed Page is one of the most common UI and Navigation elements to accommodate a large amount of data into multiple views with clear distinction. Let's say you're developing a reminder app and want to separate your week's reminders into different tabs. This can be easily achieved in Xamarin Forms with a few lines of C# code. The result you'll get is native looking tabbed pages on Android, iOS, and Windows Phone. Tab formats on all the three mobile platforms is as follows:

Android: Tabs are placed at the top and the detail area is below the tabs. Names of the tabs are automatically capitalized. You can use the swipe gesture to switch between the tabs and load the detail area of the corresponding tab. Users can also scroll through the collection of tabs if they don't fit on one screen.

Windows Phone: Windows Phone has an almost identical approach to tabbed layouts as Android with the only major difference being the names of the tabs are shown in lower case.

iOS: With iOS, the tabs are at the bottom and the detail area is loaded on the top. Each tab has an accompanying icon which should be a 90x90 PNG image. For other five tabs, you will see a more tab which can be used for additional tabs.

As it is evident from the example above, each platform treats navigation in a different way and Xamarin being a robust cross-platform app development framework does a great job in keeping it simple for developers.

In more complex mobile applications, you'll need to combine various navigation interfaces to deliver a seamless experience. For instance, hierarchical navigation is implemented to enable the user to navigate through different app pages, forwards and backward, as desired. In Xamarin.Forms it's implemented as LIFO or last-in, first-out stack of page objects. Again on each mobile platform, hierarchical navigation is treated differently and xamarin.forms take care of it out-of-the-box.

In the end, choosing a navigation type depends on your app's use case. You can develop a simple app using only tabbed navigation or combine hierarchical navigation with modal page and pop-ups and give more depth to navigation on your app.

Let us know your opinions on navigation in Xamarin.Forms through the comments below.