简体   繁体   English

在 Webview2 (WPF) 中管理对话框

[英]Manage Dialogbox in the Webview2 (WPF)

I would like to manage the dialogbox generated by the webview2.我想管理 webview2 生成的对话框。 Example: Confirm a command or download.示例:确认命令或下载。

I saw that maybe it was the CoreWebView2.ScriptDialogOpening event.我看到可能是 CoreWebView2.ScriptDialogOpening 事件。 But I don't know how to use it.但我不知道如何使用它。 So, have you an example because I don't find this Event in WPF那么,你有没有一个例子,因为我在 WPF 中找不到这个事件

Thanks a lot非常感谢

The WebView2 control doesn't expose the same APIs that CoreWebView2 does. WebView2 控件不公开与 CoreWebView2 相同的 API。 Instead the WebView2 exposes some basic APIs that CoreWebView2 does and for the rest it exposes its CoreWebView2 object via its CoreWebView2 property.相反,WebView2 公开了 CoreWebView2 所做的一些基本 API,对于 rest,它通过其 CoreWebView2 属性公开了其 CoreWebView2 object。 This property is non-null after the WebView2 control has been initialized by awaiting the EnsureCoreWebView2Async method or the CoreWebView2Ready event is raised.在通过等待 EnsureCoreWebView2Async 方法或引发 CoreWebView2Ready 事件初始化 WebView2 控件后,此属性为非 null。 You can read more about the WebView2 control initializing the CoreWebView2 in our docs.您可以在我们的文档中阅读有关初始化 CoreWebView2 的 WebView2 控件的更多信息。

So you can find the event on webView2.CoreWebView2.ScriptDialogOpening after the CoreWebView2 is initialized所以可以在webView2.CoreWebView2.ScriptDialogOpening初始化后在webView2.CoreWebView2.ScriptDialogOpening上找到事件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM