Share via


NavigationFailedEventHandler 代理人

定義

表示將處理 WebView.NavigationFailedFrame.NavigationFailed 事件的方法。

public delegate void NavigationFailedEventHandler(Platform::Object ^ sender, NavigationFailedEventArgs ^ e);
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
[Windows.Foundation.Metadata.Guid(2546608982, 55019, 24530, 166, 117, 163, 57, 100, 14, 237, 186)]
public delegate void NavigationFailedEventHandler(object sender, NavigationFailedEventArgs e);
Public Delegate Sub NavigationFailedEventHandler(sender As Object, e As NavigationFailedEventArgs)

參數

sender
Object

Platform::Object

附加處理常式的物件。

e
NavigationFailedEventArgs

事件的事件資料。

屬性

範例

下列程式碼範例示範如何使用 NavigationFailed 事件。

void WebView1_NavigationFailed(object sender, NavigationFailedEventArgs e)
{
    var dialog = new Windows.UI.Popups.MessageDialog();
    dialog.Title = "Navigation Failed";
    dialog.Content = String.Format("Could not navigate to {0}, Reason: {1}", 
        e.SourcePageType.ToString(), e.Exception.Message);
    dialog.ShowAsync();
}

適用於