NavigationService.NavigationFailed 事件
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在导航到所请求内容出错时发生。
public:
event System::Windows::Navigation::NavigationFailedEventHandler ^ NavigationFailed;
public event System.Windows.Navigation.NavigationFailedEventHandler NavigationFailed;
member this.NavigationFailed : System.Windows.Navigation.NavigationFailedEventHandler
Public Custom Event NavigationFailed As NavigationFailedEventHandler
Public Event NavigationFailed As NavigationFailedEventHandler
事件类型
示例
以下示例演示如何处理 NavigationFailed。
void NavigationService_NavigationFailed(object sender, NavigationFailedEventArgs e)
{
string msg = string.Format("Navigation to {0} failed: {1}.", e.Uri.OriginalString, e.Exception.Message);
this.progressStatusBarItem.Content = msg;
}
Private Sub NavigationService_NavigationFailed(ByVal sender As Object, ByVal e As NavigationFailedEventArgs)
Dim msg As String = String.Format("Navigation to {0} failed: {1}.", e.Uri.OriginalString, e.Exception.Message)
Me.progressStatusBarItem.Content = msg
End Sub
注解
WebException在导航过程中引发 或 IOException 时,将NavigationFailed引发 事件。 NavigationFailed 将传递一个 , NavigationFailedEventArgs 它封装有关异常的信息以及导致异常的导航的详细信息。
当导航失败导致异常且未处理时,将按列出的顺序引发以下事件:
如果导航器 (NavigationWindow, Frame 则) 由一个或多个导航器托管, NavigationFailed
不会在任何导航器上引发。