public override async Task OnNavigatingFromAsync(NavigatingEventArgs args) { var goingToDetails = args.TargetPageType == typeof(Views.DetailPage); if (goingToDetails) { var dialog = new ContentDialog { Title = "Confirmation", Content = "Are you sure?", PrimaryButtonText = "Continue", SecondaryButtonText = "Cancel", }; var result = await dialog.ShowAsyncEx(); args.Cancel = result == ContentDialogResult.Secondary; } }
public async override Task <bool> CanNavigateAsync(IConfirmNavigationParameters parameters) { var goingToDetails = parameters.ToNavigationInfo.PageType == typeof(Views.DetailPage); if (goingToDetails) { var dialog = new ContentDialog { Title = "Confirmation", Content = "Are you sure?", PrimaryButtonText = "Continue", SecondaryButtonText = "Cancel", }; var result = await dialog.ShowAsyncEx(); return(result != ContentDialogResult.Secondary); } else { return(true); } }