Partilhar via


CoreWebView2Controller.IsVisible Property

Definition

Determines whether to show or hide the WebView.

public bool IsVisible { get; set; }
member this.IsVisible : bool with get, set
Public Property IsVisible As Boolean

Property Value

Remarks

If `IsVisible` is set to `false`, the WebView is transparent and is not rendered. However, this does not affect the window containing the WebView (the `ParentWindow` parameter that was passed to CreateCoreWebView2ControllerAsync(IntPtr)). WebView 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. There are CPU and memory benefits when the page is hidden. For instance Chromium has code that throttles activities on the page like animations and some tasks are run less frequently. Similarly, WebView2 will purge some caches to reduce memory usage.

Applies to

See also