Home > Metro, Windows 8 > Windows 8 Apps: Page navigation with XAML

Windows 8 Apps: Page navigation with XAML

Windows 8 Apps are always fullscreen. The concept of overlapping windows like in Desktop applications is not existing. Only popup style dialogs are ok to use. In most scenarios it will be necessary to have different windows for displaying different data. Only one window is vivible at any time. All previous windows are hidden.

But Windows can track the list of previously displayed windows inside a single application.

Every page, except for the main page will show a back button at the top left corner. This concept is known from Windows Phone and makes it easy for users to navigate inside the app.

It is recommended to use the template "Basic Page" for all pages, which is inheriting a lot of functionality from inside the LayoutAwarePage class.

The Navigation functionality is placed inside the Frame class.

rootFrame.Navigate(typeOf(DestinationPage), objParam) allows to change to the given page by just using its typename.

There are is also GoBack and GoForward() functions, which act on the current stack.

The properties CanGoBack and CanGoForward can be used as an indicator, whether it’s useful to display the BackButton or not.

This code will change the current page to SecondPage, where the template code from BasicPage already makes sure, that the SecondPage will display a BackButton at the left top:

private void btnGotoSecondPage_Click_1(object sender, RoutedEventArgs e)
{
    this.Frame.Navigate(typeof(SecondPage));
}

image image

Categories: Metro, Windows 8
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: