Partilhar via


CoreWebView2Controller Class

Definition

This class is the owner of the CoreWebView2 object, and provides support for resizing, showing and hiding, focusing, and other functionality related to windowing and composition.

public class CoreWebView2Controller
type CoreWebView2Controller = class
Public Class CoreWebView2Controller
Inheritance
CoreWebView2Controller
Derived

Remarks

The CoreWebView2Controller owns the CoreWebView2, and if all references to the CoreWebView2Controller go away, the WebView will be closed.

Properties

AllowExternalDrop

Gets or sets the WebView allow external drop property.

Bounds

Gets or sets the WebView bounds.

BoundsMode

Gets or sets the WebView bounds mode. BoundsMode affects how setting the @CoreWebView2Controller.Bounds and @CoreWebView2Controller.RasterizationScale properties work. Bounds mode can either be in @CoreWebView2BoundsMode$.UseRawPixels mode or @CoreWebView2BoundsMode$.UseRasterizationScale mode.

CoreWebView2

Gets the CoreWebView2 associated with this CoreWebView2Controller.

DefaultBackgroundColor

Gets or sets the WebView default background color.

IsVisible

Determines whether to show or hide the WebView.

ParentWindow

Gets the parent window provided by the app or sets the parent window that this WebView is using to render content.

RasterizationScale

Gets or sets the WebView rasterization scale.

ShouldDetectMonitorScaleChanges

Determines whether the WebView will detect monitor scale changes.

ZoomFactor

Gets or sets the zoom factor for the WebView.

Methods

Close()

Closes the WebView and cleans up the underlying browser instance.

MoveFocus(CoreWebView2MoveFocusReason)

Moves focus into WebView.

NotifyParentWindowPositionChanged()

Tells WebView that the main WebView parent (or any ancestor) HWND moved.

SetBoundsAndZoomFactor(Rect, Double)
SetBoundsAndZoomFactor(Rectangle, Double)

Updates Bounds and ZoomFactor properties at the same time.

Events

AcceleratorKeyPressed

AcceleratorKeyPressed is raised when an accelerator key or key combo is pressed or released while the WebView is focused.

GotFocus

GotFocus is raised when WebView gets focus.

LostFocus

LostFocus is raised when WebView loses focus.

MoveFocusRequested

MoveFocusRequested is raised when user tries to tab out of the WebView.

RasterizationScaleChanged

RasterizationScaleChanged is raised when the RasterizationScale property changes.

ZoomFactorChanged

ZoomFactorChanged is raised when the ZoomFactor property changes.

Applies to