private void Navigation_Frame_NavigationFailed(object sender, NavigationFailedEventArgs e) { //Log the error message Debug.WriteLine($"Navigation failed: {e.Exception.Message}"); //Display a friendly error message var dialog = new MessageDialog("Navigation failed due to an error"); dialog.ShowAsync(); }
private void Navigation_Frame_NavigationFailed(object sender, NavigationFailedEventArgs e) { //Redirect to a custom error page var errorPage = new ErrorPage(e.Exception); NavigationService.Navigate(errorPage); }In this example, the event handler for the NavigationFailed event redirects the user to a custom error page that displays information about the error. The ErrorPage constructor takes the NavigationFailedEventArgs property Exception as a parameter, allowing it to display detailed error information to the user. Package Library: Windows.Foundation.UniversalApiContract (in Microsoft.NETCore.UniversalWindowsPlatform NuGet package)