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
則不會在任何導覽器上引發。