Sahil Thapar
Sahil Thapar

Reputation: 301

Generating a back key event

How can I generate a back key press event through the code in Windows Phone 7 App.

I have an exit button in the app and would like to give it the same functionality as a back button. Basically generating the same event as a back key press would.

Any other ideas on ways to exit and application without actually pressing the back key.

Upvotes: 0

Views: 69

Answers (1)

ken2k
ken2k

Reputation: 48975

You can use NavigationService in your page:

if (this.NavigationService.CanGoBack)
{
    this.NavigationService.GoBack();
}

Upvotes: 2

Related Questions