Partilhar via


Navigating between pages (XAML)

[This article is for Windows 8.x and Windows Phone 8.x developers writing Windows Runtime apps. If you’re developing for Windows 10, see the latest documentation]

Learn how Windows Runtime apps using C++, C#, or Visual Basic support navigation between pages and content.

Most Windows Runtime apps have multiple pages of content and functionality for users to explore and engage with. Here, we explain how Windows Runtime apps using C++, C#, or Visual Basic typically use a single-page navigation model and how to implement navigation using dedicated controls.

Multi-page navigation is used to navigate between pages or screens without worrying about app context. Each page has its own set of functions and data, a new set of XAML to display, style information, and so on. This is very typical of web pages within a website.

In contrast, a single-page navigation model uses a single page to maintain app context and load additional data and content, as needed. You still split your application into multiple files, but instead of moving from page to page, your app loads other documents into the main page. Because your app's main page is never unloaded, your scripts are never unloaded, which makes it easier to manage state, transitions, or animations. We recommend that Windows Store apps using C++, C#, or Visual Basic use the single-page navigation model.

The Microsoft Visual Studio project templates for Windows Runtime apps using C++, C#, or Visual Basic (Hub, Grid, and Split) use the single-page navigation model. In this model, XAML pages get loaded into a central frame as the content of the default Window, and then users navigate to other pages using that frame. The pages are loaded as needed, typically in response to user actions. This provides a smoother, app-like transition between pages, and also makes it easier to manage app state. See C#, VB, and C++ project templates for Windows Runtime apps to get an overview of the templates.

For help choosing the best navigation pattern for your app, see Navigation patterns.

See the Flat navigation and Hierarchical navigation patterns in action as part of our App features, start to finish series.

In this section

Topic Description

Quickstart: Navigating between pages

This topic discusses basic navigation concepts and demonstrates how to create an app that navigates between two pages.

How to link to external webpages

Learn how to link to external webpages and display them in your Windows Runtime app using C# or Visual Basic.

 

For designers

Navigation patterns

Command patterns

Layout

Back button

Guidelines for the hub control

Guidelines for app bars (Windows Store apps)

Making the app bar accessible

For developers (XAML)

Windows.UI.Xaml.Controls Hub class

Windows.UI.Xaml.Controls AppBar class

Windows.UI.Xaml.Controls CommandBar class

Your first app - Part 3: Navigation, layout, and views

Your first app - Add navigation and views in a C++ Windows Store app (tutorial 3 of 4)

XAML Hub control sample

XAML AppBar control sample

XAML Navigation sample

Adding app bars (XAML)

Quickstart: Navigating between pages