In-app navigation for Windows Phone
February 03, 2014
Applies to: Windows Phone 8 | Windows Phone OS 7.1
This topic contains the following sections.
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.
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.
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
A page fills the entire content region of the frame. A page includes the following characteristics:
Optionally surfaces its own 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.
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.
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.
For a code example of setting status bar properties, see SystemTray.
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.
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.
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.
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.
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
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.