Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Note
This reference is no longer being maintained. For the latest API reference, see WebView2 API Reference.
Note
This an experimental API that is shipped with our prerelease SDK. See WebView2 release notes.
interface ICoreWebView2ExperimentalWindowControlsOverlay
: public IUnknown
This is the ICoreWebView2ExperimentalWindowControlsOverlay.
Summary
| Members | Descriptions |
|---|---|
| get_BackgroundColor | Gets the BackgroundColor property. |
| get_Height | Gets the Height property. |
| get_IsEnabled | Gets the IsEnabled property. |
| put_BackgroundColor | The BackgroundColor property allows you to set a background color for the overlay. |
| put_Height | The Height property in pixels, allows you to set the height of the overlay and title bar area. |
| put_IsEnabled | The IsEnabled property allows you to opt in to using the WebView2 window controls overlay. |
Applies to
| Product | Introduced |
|---|---|
| WebView2 Win32 | N/A |
| WebView2 Win32 Prerelease |
Members
get_BackgroundColor
Gets the BackgroundColor property.
public HRESULT get_BackgroundColor(COREWEBVIEW2_COLOR * value)
get_Height
Gets the Height property.
public HRESULT get_Height(UINT32 * value)
get_IsEnabled
Gets the IsEnabled property.
public HRESULT get_IsEnabled(BOOL * value)
put_BackgroundColor
The BackgroundColor property allows you to set a background color for the overlay.
public HRESULT put_BackgroundColor(COREWEBVIEW2_COLOR value)
Based on the background color you choose, Webview2 will automatically calculate a foreground and hover color. Defaults to #f3f3f3
put_Height
The Height property in pixels, allows you to set the height of the overlay and title bar area.
public HRESULT put_Height(UINT32 value)
Defaults to 48px.
std::wstring sampleUri = appWindow->GetLocalUri(c_samplePath);
WebViewCreateOption options = appWindow->GetWebViewOption();
options.useWco = true;
AppWindow* appWindowWco = new AppWindow(appWindow->GetCreationModeId(), options, sampleUri);
put_IsEnabled
The IsEnabled property allows you to opt in to using the WebView2 window controls overlay.
public HRESULT put_IsEnabled(BOOL value)
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 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 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 property which can be used to get the titlebar area as a rect, and listen for changes to the size of that area.
std::wstring sampleUri = appWindow->GetLocalUri(c_samplePath);
WebViewCreateOption options = appWindow->GetWebViewOption();
options.useWco = true;
AppWindow* appWindowWco = new AppWindow(appWindow->GetCreationModeId(), options, sampleUri);