Jonas Stawski

Everything .NET and More

My Windows Phone 7 App failed… Requirement 5.2.4.c

So I submitted my third app, Shapes, into the WP7 Marketplace and 48 hours later I get an email saying it failed. I read the details and it failed because of requirement 5.2.4.c:

If the current page displays a context menu or a
dialog, the pressing of the Back button must close
the menu or dialog and cancel the backward
navigation to the previous page.

The expected result:

Test Process Required:
1. Launch the application.
2. Navigate through the application.
3. Bring up a context menu or a dialog.
4. Select the device Back Button.
5. Ensure the menu or a dialog in focus is closed,
and returns the user to the screen where the
menu or the dialog was originally opened.

So during my app I use a user control to display dialogs or menus, which do not use the NavigationService. The bottom line is that I forgot to enable the back button to close the menu. Therefore, if the dialog is displayed and the user presses the back button, the previous screen is shown. To solve this simply override the OnBackKeyPress. Here’s what I did:

   1: protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
   2: {
   3:   if (dialog.Visibility == System.Windows.Visibility.Visible)
   4:   {
   5:     e.Cancel = true;
   6:     HideDialog();
   7:   }
   8:   base.OnBackKeyPress(e);
   9: }

Happy Programming!

Add comment

biuquote
Loading