You are designing a Windows Phone 7 application that consists of a single XAML page. A rectangle that is hidden within the page appears as a result of a user action. You need to ensure that the rectangle is hidden and the application remains open when the user presses the Back key. Which code segment should you use?
A.
protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e) {
if (popUp.Visibility == System.Windows.Visibility.Visible) {
B.
Cancel = true;
popUp.Visibility = System.Windows.Visibility.Collapsed; }
}
C.
void NavigationService_Navigating(object sender,
System.Windows.Navigation.NavigatingCancelEventArgs e) {
if (e.NavigationMode == System.Windows.Navigation.NavigationMode.Back) {
D.
Cancel = true;
popUp.Visibility = System.Windows.Visibility.Collapsed; }
}
E.
protected override void
OnNavigatingFrom(System.Windows.Navigation.NavigatingCancelEventArgs e) {
base.OnNavigatingFrom(e);
F.
Cancel = true;
popUp.Visibility = System.Windows.Visibility.Collapsed; }
G.
protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e) {
base.OnNavigatedFrom(e);
popUp.Visibility = System.Windows.Visibility.Collapsed; }