Share via


CoreWebView2WindowControlsOverlay Class

Definition

public class CoreWebView2WindowControlsOverlay
type CoreWebView2WindowControlsOverlay = class
Public Class CoreWebView2WindowControlsOverlay
Inheritance
CoreWebView2WindowControlsOverlay

Properties

BackgroundColor

The BackgroundColor property allows you to set a background color for the overlay. Based on the background color you choose, Webview2 will automatically calculate a foreground and hover color. Defaults to #f3f3f3

Height

The Height property in pixels, allows you to set the height of the overlay and title bar area. Defaults to 48px.

IsEnabled

The IsEnabled property allows you to opt in to using the WebView2 window controls overlay. Defaults to FALSE.

        When this property is `TRUE`, WebView2 will draw its own minimize, maximize,
        and close buttons on the top right corner of the Webview2. 

        When using this you should configure your app window to not display its default
        window control buttons. You are responsible for creating a title bar for your app
        by using the available space to the left of the controls overlay. In doing so, 
        you can utilize the [IsNonClientRegionSupportEnabled](https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2settings9?view=webview2-1.0.2739.15)
        API to enable draggable regions for your custom title bar.

        The Overlay buttons will sit on top of the HTML content, and will prevent mouse interactions
        with any elements directly below it, so you should avoid placing content there. 
        To that end, there are four [CSS environment variables](https://learn.microsoft.com/en-us/microsoft-edge/progressive-web-apps-chromium/how-to/window-controls-overlay#use-css-environment-variables-to-stay-clear-of-the-overlay) 
        defined to help you get the dimensions of the available titlebar area to the left of the overlay.
        Similarly the navigator object will contain a [WindowControlsOverlay](https://learn.microsoft.com/en-us/microsoft-edge/progressive-web-apps-chromium/how-to/window-controls-overlay#react-to-overlay-changes)
        property which can be used to get the titlebar area as a rect, 
        and listen for changes to the size of that area.

Applies to