When you have an application that navigates to more than one level of pages you find situations where you don’t want to go back to the previous page. Originally I was thinking that the answer was to capture the OnBackButton event and force the navigation back to the main page, but through several posts I found that this would not pass certification. Here is a link that really helped to figure out a more appropriate solution.
To be a little more complete here is example code that you can use use for both the intermediate page and the main page.
Intermediate page code:
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
App app = (App) Application.Current;
if(app.MustNavigateBack)
{
NavigationService.GoBack();
}
}
Main page code:
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
App app = (App) Application.Current;
app.MustNavigateBack = false;
}