Compartir a través de


In-app navigation for Windows Phone 8

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

This topic contains the following sections.

Overview

In Windows Phone applications users can navigate forward through different screens of content. Also, you can move backward using the Windows Phone hardware Back button. This model enables developers to:

  • Easily create view-based applications that fit naturally into the Windows Phone navigation model

  • Provide default transitions that match the Windows Phone look and feel

The core elements include a top-level container control called a PhoneApplicationFrame that can host a PhoneApplicationPage. Pages hold discrete sections of content in your application. The Windows Phone app platform provides frame and page classes to facilitate navigation to separate sections of content. You can create as many different pages as needed to present the content in your application and then navigate to those pages from the frame. The following figure illustrates a possible frame and page hierarchy for an application.

Important Note:

You must use the PhoneApplicationFrame and PhoneApplicationPage types when developing your application and not the standard Frame and Page types. For more information, see the PhoneApplicationFrame and PhoneApplicationPage classes in the class library reference.

 

 

Frames

A frame integrates with the Windows Phone look and feel so that it appears like any other application. Only a single frame is available to the application with no exceptions. A frame includes the following characteristics:

  • Exposes properties from a hosted page such as screen orientation

  • Exposes a client area where pages are rendered

  • Exposes a NavigationService that facilitates navigating between pages

  • Reserves space for the status bar and Application Bar

Note

The frame is also the place where you receive obscured or unobscured events for certain interactions, such as phone calls. For more information, see Obscured and Unobscured.

Pages

A page fills the entire content region of the frame. A page includes the following characteristics:

  • Optionally surfaces its own application bar

Status Bar and Application Bar

The status bar and Application Bar represent the application chrome. The client area is the window that the host application can draw into, and the logical client area is the space visible to the user. Application content may exist outside of the logical client area, for example, in a vertically scrolling scenario.

Status Bar

The status bar displays system-level status information in a simple and clean manner, reserved in the application workspace. The user may interact with the status bar, as it updates to provide different notifications and keep the user aware of things that are important.

Note

The status bar is also referred to as the system tray.

A status bar includes the following characteristics:

  • The visibility of the status bar can be changed by your application.

  • The opacity of the status bar can be changed in your application.

  • The color of the status bar can be changed in your application.

  • The progress indicator on the status bar can be used in your application to show progress.

Note

For a code example of setting status bar properties, see SystemTray.

Application Bar

The Application Bar provides a place to promote the most common tasks. For less common tasks, applications can include a single menu launched from the Application Bar.

An Application Bar includes the following characteristics:

  • The visibility of the Application Bar can be changed by your application.

  • The opacity of the Application Bar can be changed in your application.

  • The color of the Application Bar can be changed in your application.

Orientation

Windows Phone supports orientation changes, both portrait and landscape. If necessary, applications must be configured to support multiple orientations, and by default are set to support only portrait orientation. If a specified page on the application supports both landscape and portrait orientation, the user can initiate a change by physically rotating the device. There is no programmatic way to directly switch the orientation, because the orientation property is set to read-only. The only method to accomplish this is to set the SupportedOrientations property to the desired orientation.

Note

The orientation portrait down, or upside down, is not supported in Windows Phone. Applications that need to use this feature can use the device accelerometer to change the UI; however, the chrome will remain in the normal portrait mode.

The page has an Orientation property and a SupportedOrientations property. If the application navigates to a page where the SupportedOrientations property does not include the current orientation, it will initiate a UI orientation change to the specified orientation.

Back Button

The hardware Back button is used to go back within an application or between applications. Also, the Back button can close an on-screen keyboard, menus, or dialogs, navigate to a previous page, or even switch applications. However, the principal usage is to move from a current screen to the previous screen.

Important Note:

There are several requirements related to the use of the Back button that your application must meet in order to pass certification and be eligible for listing in Store. For more information, see Technical certification requirements for Windows Phone

Note

The Navigating event will allow you to cancel navigation, but it will work only if the navigation was initiated by an API call. If it was initiated by the Back button, or the Start button, you cannot cancel the navigation. For the Back button, you can cancel navigation using the OnBackKeyPress(CancelEventArgs) method, but you cannot cancel navigation from the Start button.

See Also

Other Resources

Navigation, orientation, and gestures for Windows Phone

App structure and navigation models for Windows Phone