NavigationFailedEventHandler 委托

定义

表示将处理 WebView.NavigationFailedFrame.NavigationFailed 事件的方法。

public delegate void NavigationFailedEventHandler(Platform::Object ^ sender, NavigationFailedEventArgs ^ e);
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Guid(1303070321, 4786, 17351, 184, 146, 155, 226, 220, 211, 232, 141)]
class NavigationFailedEventHandler : MulticastDelegate
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Guid(1303070321, 4786, 17351, 184, 146, 155, 226, 220, 211, 232, 141)]
public delegate void NavigationFailedEventHandler(object sender, NavigationFailedEventArgs e);
Public Delegate Sub NavigationFailedEventHandler(sender As Object, e As NavigationFailedEventArgs)

参数

sender
Object

Platform::Object

IInspectable

附加处理程序的对象。

e
NavigationFailedEventArgs

事件的事件数据。

属性

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)

示例

下面的代码示例演示如何使用 NavigationFailed 事件。

void webViewA_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();
}

适用于