WebView2CompositionControl.BeginInit Method

Definition

Implementation of the ISupportInitialize pattern. Prevents the control from implicitly initializing its CoreWebView2 until EndInit() is called. Does not prevent explicit initialization of the CoreWebView2 (i.e. EnsureCoreWebView2Async(CoreWebView2Environment, CoreWebView2ControllerOptions)). Mainly intended for use by interactive UI designers.

public override void BeginInit ();
override this.BeginInit : unit -> unit
Public Overrides Sub BeginInit ()

Implements

Remarks

Note that the "Initialize" in ISupportInitialize and the "Init" in BeginInit/EndInit mean something different and more general than this control's specific concept of initializing its CoreWebView2 (explicitly or implicitly). This ISupportInitialize pattern is a general way to set batches of properties on the control to their initial values without triggering any dependent side effects until all of the values are set (i.e. until EndInit is called). In the case of this control, a specific side effect to be avoided is triggering implicit initialization of the CoreWebView2 when setting the Source property. For example, normally if you set CreationProperties after you've already set Source, the data set to CreationProperties is ignored because implicit initialization has already started. However, if you set the two properties (in the same order) in between calls to BeginInit and EndInit then the implicit initialization of the CoreWebView2 is delayed until EndInit, so the data set to CreationProperties is still used even though it was set after Source.

Applies to