O'Reilly logo

Beginning Windows® Phone 7 Application Development: Building Windows® Phone Applications Using Silverlight® and XNA® by Robert Fonseca-Ensor, Karli Watson, Nick Lecrenski

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

UNDERSTANDING THE BACK BUTTON

All Windows Phone 7 devices have three hardware buttons: Back, Start, and Search. You can change the behavior of only the Back button. In this section, you'll look at what the Back button does and how you can respond to a user pressing it.

Taking Advantage of the Back Button's Functionality

The Back button in a Windows Phone 7 device fulfills the same function as a Back button in a browser. Essentially, the device maintains a page history, and as you press the Back button, the device moves backward through this history. From the main page of an application, this means going back to whatever application was previously active, or, if none was active, returning to the device's home page.

image NOTE Using the Back button is one of the only ways to exit an application. There is no code that you can write to terminate an application; that is, there is no App.Terminate() method or anything similar. Instead, you rely on the user choosing to exit and can only respond to the user's action.

Although this behavior is by design, some people in the developer community seem quite offended by the prospect of not being able to terminate their applications. However, it's unlikely that this situation will change.

The user can also press the Back button on other pages in your application, with similar results: when the user presses this button, he is returned to the main page ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required