共用方式為


WebView2.CoreWebView2InitializationCompleted Event

Definition

This event is triggered either 1) when the control's CoreWebView2 has finished being initialized (regardless of how it was triggered or whether it succeeded) but before it is used for anything OR 2) the initialization failed. You should handle this event if you need to perform one time setup operations on the CoreWebView2 which you want to affect all of its usages (e.g. adding event handlers, configuring settings, installing document creation scripts, adding host objects).

public event EventHandler<Microsoft.Web.WebView2.Core.CoreWebView2InitializationCompletedEventArgs> CoreWebView2InitializationCompleted;
member this.CoreWebView2InitializationCompleted : EventHandler<Microsoft.Web.WebView2.Core.CoreWebView2InitializationCompletedEventArgs> 
Public Event CoreWebView2InitializationCompleted As EventHandler(Of CoreWebView2InitializationCompletedEventArgs) 

Event Type

Remarks

This sender will be the WebView2 control, whose CoreWebView2 property will now be valid (i.e. non-null) for the first time if IsSuccess is true. Unlikely this event can fire second time (after reporting initialization success first) if the initialization is followed by navigation which fails.

Applies to