private async void App_OnBackRequested(object sender, BackRequestedEventArgs e) { e.Handled = true; if (IsDirty) { MessageDialog messageDialog = MessageDialogHelper.CreateDialogForConfirmOnExit(); var result = await messageDialog.ShowAsync(); if (result.Label.Equals("Yes") && NavigationHelper.CanGoBack()) { NavigationHelper.GoBack(); IsDirty = false; } } else { if (NavigationHelper.CanGoBack()) { NavigationHelper.GoBack(); e.Handled = true; } } }