Closes the WebView and cleans up the underlying browser instance. Cleaning up the browser instance releases the resources powering the WebView. The browser instance is shut down if no other WebViews are using it.
Moves focus into WebView. WebView gets focus and focus is set to correspondent element in the page hosted in the WebView. For Programmatic reason, focus is set to previously focused element or the default element if no previously focused element exists. For Next reason, focus is set to the first element. For Previous reason, focus is set to the last element. WebView changes focus through user interaction including selecting into a WebView or Tab into it. For tabbing, the app runs MoveFocus with Next or Previous to align with Tab and Shift+Tab respectively when it decides the WebView is the next element that may exist in a tab. Or, the app runs IsDialogMessage as part of the associated message loop to allow the platform to auto handle tabbing. The platform rotates through all windows with WS_TABSTOP. When the WebView gets focus from IsDialogMessage, it is internally put the focus on the first or last element for tab and Shift+Tab respectively.
This is a notification separate from Bounds that tells WebView that the main WebView parent (or any ancestor) HWND moved. This is needed for accessibility and certain dialogs in WebView to work correctly.
Updates Bounds and ZoomFactor properties at the same time. This operation is atomic from the perspective of the host. After returning from this function, the Bounds and ZoomFactor properties are both updated if the function is successful, or neither is updated if the function fails. If Bounds and ZoomFactor are both updated by the same scale (for example, Bounds and ZoomFactor are both doubled), then the page does not display a change in window.innerWidth or window.innerHeight and the WebView renders the content at the new size and zoom without intermediate renderings. This function also updates just one of ZoomFactor or Bounds by passing in the new value for one and the current value for the other.
Adds an event handler for the AcceleratorKeyPressed event. AcceleratorKeyPressed runs when an accelerator key or key combo is pressed or released while the WebView is focused. A key is considered an accelerator if either of the following conditions are true.
Adds an event handler for the GotFocus event. GotFocus runs when WebView has focus.
Adds an event handler for the LostFocus event. LostFocus runs when WebView loses focus. In the case where MoveFocusRequested event is run, the focus is still on WebView when MoveFocusRequested event runs. LostFocus only runs afterwards when code of the app or default action of MoveFocusRequested event set focus away from WebView.
Adds an event handler for the MoveFocusRequested event. MoveFocusRequested runs when user tries to tab out of the WebView. The focus of the WebView has not changed when this event is run.
Adds an event handler for the ZoomFactorChanged event. ZoomFactorChanged runs when the ZoomFactor property of the WebView changes. The event may run because the ZoomFactor property was modified, or due to the user manually modifying the zoom. When it is modified using the ZoomFactor property, the internal zoom factor is updated immediately and no ZoomFactorChanged event is triggered. WebView associates the last used zoom factor for each site. It is possible for the zoom factor to change when navigating to a different page. When the zoom factor changes due to a navigation change, the ZoomFactorChanged event runs right after the ContentLoading event.
The WebView bounds. Bounds are relative to the parent HWND. The app has two ways to position a WebView.
Gets the CoreWebView2 associated with this CoreWebView2Controller.
The IsVisible property determines whether to show or hide the WebView2. If IsVisible is set to FALSE, the WebView2 is transparent and is not rendered. However, this does not affect the window containing the WebView2 (the HWND parameter that was passed to CreateCoreWebView2Controller). If you want that window to disappear too, run ShowWindow on it directly in addition to modifying the IsVisible property. WebView2 as a child window does not get window messages when the top window is minimized or restored. For performance reasons, developers should set the IsVisible property of the WebView to FALSE when the app window is minimized and back to TRUE when the app window is restored. The app window does this by handling SIZE_MINIMIZED and SIZE_RESTORED command upon receiving WM_SIZE message.
The parent window provided by the app that this WebView is using to render content. This API initially returns the window passed into CreateCoreWebView2Controller.
The zoom factor for the WebView.
Sets the Bounds property.
Sets the IsVisible property.
Sets the parent window for the WebView. This causes the WebView to re-parent the main WebView window to the newly provided window.
Sets the ZoomFactor property.
Removes an event handler previously added with add_AcceleratorKeyPressed.
Removes an event handler previously added with add_GotFocus.
Removes an event handler previously added with add_LostFocus.
Removes an event handler previously added with add_MoveFocusRequested.
Remove an event handler previously added with add_ZoomFactorChanged.