Lingua

CoreWebView2ControllerOptions Class

Definition

Used to manage profile options that are created by CreateCoreWebView2ControllerOptions().

public class CoreWebView2ControllerOptions
type CoreWebView2ControllerOptions = class
Public Class CoreWebView2ControllerOptions
Inheritance
CoreWebView2ControllerOptions

Properties

Name Description
AllowHostInputProcessing

AllowHostInputProcessing property is to enable/disable input passing through the app before being delivered to the WebView2. This property is only applicable to controllers created with CreateCoreWebView2ControllerAsync(IntPtr) and not composition controllers created with CreateCoreWebView2CompositionControllerAsync(IntPtr, CoreWebView2ControllerOptions). By default the value is false. Setting this property has no effect when using visual hosting.

DefaultBackgroundColor

This property allows users to initialize the DefaultBackgroundColor early, preventing a white flash that can occur while WebView2 is loading when the background color is set to something other than white. With early initialization, the color remains consistent from the start. After initialization, DefaultBackgroundColor will return the value set using this API.

The DefaultBackgroundColor can be set via the WEBVIEW2_DEFAULT_BACKGROUND_COLOR environment variable, which will remain supported for cases where this solution is being used. It is encouraged to transition away from the environment variable and use this API solution to apply the property. It is important to highlight that when set, the environment variable overrides DefaultBackgroundColor and becomes the initial value of DefaultBackgroundColor.

The DefaultBackgroundColor is the color that renders underneath all web content. This means WebView2 renders this color when there is no web content loaded. When no background color is defined in WebView2, it uses the DefaultBackgroundColor property to render the background. By default, this color is set to white.

This API only supports opaque colors and full transparency. It will fail for colors with alpha values that don't equal 0 or 255. When WebView2 is set to be fully transparent, it does not render a background, allowing the content from windows behind it to be visible.

IsInPrivateModeEnabled

Manage the controller's InPrivate mode.

LocaleRegion

Manages the value of the controller's locale region.

ProfileName

Manage the name of the controller's profile.

ScriptLocale

Manages the value of the controller's script locale.

Applies to