SIMPLE NAVIGATION IN WINDOWS APPLICATION

August 15, 2019
3 mins read

The Navigation of UWP Apps is extremely cool and easier than other platforms. It allows enabling a variety of intuitive user experiences for moving between apps, pages, and content.

Navigation is the key part of the Application. In your small Apps, you may maintain your contents and functionality in a single page. Perhaps the majority of apps really required multiple pages for contents and functionality. So! When an app has more than a page, you have to provide the navigation experience.

To give the user a great, you really have to care about a few major things;

Right Navigation Structure;

You have to Build such a navigation structure that makes sense to the user is crucial to creating an intuitive navigation experience. The way you arrange these pages into groups defines the app’s navigation structure. Basically, there are two common ways to arrange a group of pages;

In a hierarchy;

The pages are organized into a tree structure. To reach a child page, you travel through the parent.

As peers;

The pages exist side-by-side. You can go from one page to another in any order.

Normally an app will use both arrangements;

The hierarchical or tree structure is important you got more than 7 pages because it might be difficult for users to understand the page flow. Perhaps for less than 8 Pages or if the parent-child relation is not possible then peer relationship is important.

Use the Right Navigation Elements;

The Navigation elements should help the user get to the content they want and should also let users know where they are within the app. However, they also take up space that could be used for content or commanding elements, so it’s important to use the navigation elements that are right for your app’s structure.

The Navigation elements can provide two services: they help the user get to the content they want, and some elements also let users know where they are within the app. However, they also take up space that the app could use for the content or commanding elements, so it’s important to use the navigation elements that are just right for your app’s structure.

Peer-to-peer navigation elements; It enables navigation between pages in the same level of the same subtree.

If your navigation structure has multiple levels, it is recommended that peer-to-peer navigation elements only link to the peers within their current subtree. Consider the following illustration, which shows a navigation structure that has three levels;

For level 1, the peer-to-peer navigation element should provide access to pages A, B, C, and D.

At level 2, the peer-to-peer navigation elements for the A2 pages should only link to the other A2 pages. They should not link to level 2 pages in the C subtree.

Hierarchical navigation elements provide navigation between a parent page and its child pages.

Make your app work well with system-level navigation features

The Universal Windows Platform (UWP) provides a consistent back navigation system for traversing the user’s navigation history within an app and, depending on the device, from app to app.

The UI for the system back button is optimized for each form factor and input device type, but the navigation experience is global and consistent across devices and UWP apps.

Now with UWP, you’ve some more alternative input types that don’t rely on a back button UI, but still provide the exact same functionality.

Including Keyboard and Cortana (Hey Cortana, go back). : – )

When the user pressed the back button. The user expects the back button to navigate to the previous location in the app’s navigation history.

Previously in Universal Applications, it could have several pages and when we want to navigate through different pages, it opens a new window. But in Universal Windows Platform, there is only one window. When we want to open a different page, it opens a new frame.

So! let’s see how it works in Universal Windows Platform page navigation. Let’s get started;

Simply create a new blank project in Visual Studio with name ‘UWPNavigation’;

So in order to perform navigation, we need more than one page. So let’s create another Blank Page. Simply click upon add new items by right click the project and create a Blank Page with name ‘Second Page’;

Now back to the MainPage and create a button object;

And modify the Click attribute from properties;


<Button x:Name="button" 
Content="Next Page" 
HorizontalAlignment="Left" 
Margin="162,279,0,0" 
VerticalAlignment="Top" 
Height="49" Width="80" 
Click="NextPage_Click" >

In order to make the page attractive, also add TextBlock to show some text on the Page;


<StackPanel Grid.Row="0" 
Margin="19,0,0,0">
<TextBlock Text="Page Navigation" 
Style="{ThemeResource TitleTextBlockStyle}" 
Margin="0,12,0,0"/> 
<TextBlock Text="Main Page" 
Margin="0,-6.5,0,26.5" 
Style="{ThemeResource HeaderTextBlockStyle}" 
CharacterSpacing="{ThemeResource PivotHeaderItemCharacterSpacing}"/><br />
</StackPanel> 

Now in the logical file, insert the event handler for the Button object;

this.Frame.Navigate(typeof(SecondPage));

So this one line will navigate you from one page to another page…

Now in Second Page, modify the page by adding two TextBlocks for better response;

<TextBlock Text="Page Navigation" 
Style="{ThemeResource TitleTextBlockStyle}" 
Margin="0,12,0,0"/>
<TextBlock Text="Second Page"
Margin="0,-6.5,0,26.5"
Style="{ThemeResource HeaderTextBlockStyle}"
CharacterSpacing="{ThemeResource PivotHeaderItemCharacterSpacing}"
SelectionChanged="TextBlock_SelectionChanged"/>

Now add the back button;

<AppBarButton x:Name="appBarButton"
HorizontalAlignment="Left"
Icon="Back" Label=""
VerticalAlignment="Top"
Width="45" Height="44"
Click="appBarButton_Click"/>

Like before, by adding a one-line code event handler, the appBarButton will take us to MainPage again;

this.Frame.Navigate(typeof(MainPage));

Now if we run, we can see the navigation works according to our expectations;

So! See the navigation is so entrusting and logically managed in our App…

FOR HANDS ON DEMO

In order to get a best hands-on experience along with the Blog. Try out the code either By MSDN Code Samples or By GitHub.

Data Scientist & Solution Architect || IBM Recognised Speaker, Mentor, and Teacher || Debater || Blogger || Guinness World Record Holder || Watson Solution Developer || IBM Community Activist || Aspiring to Inspire.

Leave a Reply

Your email address will not be published.

Previous Story

UNDERSTANDING THE ARCHITECTURE OF UNIVERSAL WINDOWS PLATFORM

Next Story

IBM YourLearning | 2019 | justSajid

Latest from Blog

Quantum Computing | What, Why & How

Now as we are starting the 5th decade after the very first proposed model in the 1980s, quantum computers are now commercially available, brought out of the lab, and into the industry by IBM Quantum. With many experts predicting it will revolutionize the way we approach problem-solving. With the recent

Case Study: Digital Transformation of “justSajid Bank”

In this current era of what we call “digital first”, industries are repeatedly changing and evolving with the help of technology. So as the banking industry is reshaping itself, banks need to keep adopting positive changes to counter and overcome the key challenges of the modern world to overcome the

Metaverse || A Whole New World.

Things are going to be super dramatic in the next few years. Metaverse is going to open a lot of new doors to revise things that we are doing now. The culture and lifestyle would be changed. Some new cultures would have emerged and everybody would be living without physical

Pakistan Day 2020 | Coronavirus Technical Solutions

Well, on Pakistan Day 2020 our nation along with the rest of the world is facing Corona Pandemic. As the sons of this great motherland, we are trying to play our roles at our places. Within the last few weeks, Alhamdulillah I’ve got a chance to develop two technical solutions

Password: Choose the Secure, Easy and Cool Password

A super secure Password is very common nowadays. Although according to experts the password is going to expire very soon. Moreover, the pin codes are also replacing password in some why. Perhaps still there is a lot of importance of a secure password in many places. The one of the most

JumpStart with DevOps

What is DevOps; DevOps is a Software Development Strategy, that bridges the gap between the Dev and the Ops side of the company. * It’s not a tool, it’s a Methodology to bridge the gap b/w development and operations teams! As there is always a lot of conflicts between the

JumpStart Programming with Python 3

Motivation; Well, if you want to play with data and deal with complex analytics problems then Python is the best for you. We can use Python for developing complex scientific and numeric apps. Python is designed with features to facilitate data analysis and visualization. The syntax in Python helps the programmers to do coding

Understanding of Data Science Methodology

Motivation: It’s all about the different methods used in data science. Data Science Methodology: There is the following methodology used in data science which can further categories into different phases; From Problem to Approach Business Understanding Analytical Approach Working with Data Data Requirements Data Collection Data Understanding Data Preparation Deriving the

Understanding Machine Learning Methodology

Motivation Well, if we talk about a human cell sample extracted from a patient. The cell would have some characteristics. One of the interesting questions we can ask, what kind of statistics that cell have? One could easily presume that only a doctor with years of experience could diagnose a tumor and

UNDERSTANDING THE ARCHITECTURE OF UNIVERSAL WINDOWS PLATFORM

The architecture of Universal Windows Platform is most exclusive with the center of gravity which is One Windows Core. Now the whole development will follow the common refactored core that will common for all the windows Releases. It’s all about One Core, One Hardware Platform, Universal Hardware Driver and Standalone

Guinness World Record Holder | Hajj Hackathon | Khadim Al-Haramain Al-Sharifain

Khadim Al-Haramain Al-Sharifain Built an MVP of a cognitive platform name “Khadim Al-Haramain Al-Sharifain“.  Objective The objective was to facilitate Hajj operations by introducing cognitive services integrated with Hajj systems. Hence millions of Muslims who are there for Allah Rab-ul-Izat, can perform anything without disturbing their focuses and concentrations.  Functionalities

JumpStart with IBM Bluemix

IBM Bluemix is the world most exclusive cloud platform that provides developers to quickly develop, Deploy and manage Apps over the cloud without dealing with any underline infrastructure. Bluemix provides great open source platforms for your needs. Tech experts believe that up to 2020 the computing era would completely change.

JumpStart Into Big Data With HDInsight

What would happen when the volume of your data increased repeatedly over time and you need high velocity at the same time. Not only that but you have a different variety of data and Variability also exists in your data. So how would you handle all that data? If we

Microsoft SharePoint: Create an Intranet in SharePoint

As you should already have some hands on with SharePoint. So, Lets do some hands on with SharePoint Intranet for Small company. Simply start with a Blank Site Collection. Let’s assume that the company has 3 Departments: Sales, Production and Support. They each have their own area in which they should

.NET Core

.NET Core 1.0  .NET Core 1.0 is a major new investment in the future of .NET and laying the foundation for decades to come. Still, it is in its early stage, and for some time you might still focus .NET Framework 4.6 depending on your application needs. But for many scenarios,

JUMPSTART WITH DATA BINDING IN UWP

Data Binding is one of the most interesting topics in Universal App Development. In order to perform the better functionality, you really need to have some great usage of Data Binding in you Apps. So! First thing first. What is actually the Data Binding and is its usage in UWP.

justSajid | A PLACE FOR MY THOUGHTS

This blog is my personal mental playground. The views expressed are mine, and mine alone. They do not represent the views of my employer, my family, my friends, my imaginary friends, my neighbors, people who live in my city, province, country, region, or planet, nor do they represent the views

justSajid | A PLACE FOR MY THOUGHTS

justSajid is my personal mental playground. The views expressed are mine, and mine alone. They do not represent the views of my employer, my family, my friends, my imaginary friends, my neighbors, people who live in my city, province, country, region, or planet, nor do they represent the views of

Agentic AI: The Future of Machines Acting with Purpose

Artificial Intelligence (AI) has come a long way from being a fancy algorithm for chess games to becoming our digital assistant, creative collaborator, and even a philosopher’s muse. One of the more intriguing advancements in AI is Agentic AI—an AI system that can act autonomously, pursue goals, and make decisions,
GoUp

Don't Miss

UNDERSTANDING THE ARCHITECTURE OF UNIVERSAL WINDOWS PLATFORM

The architecture of Universal Windows Platform is most exclusive with

Chaseable Live Tiles: Microsoft Introduce New Live Tiles

During the Build 2016 conf, Microsoft introduced the new live tile called