webview2

Disable Devtools in Microsoft.Web.WebView2.Wpf component


I want to disable devtools from Webview2 component in wpf application .net5. Please help me how to do it?


Solution

  • After the WebView2 has been initialized.

    Do:

    webView21.CoreWebView2.Settings.AreDevToolsEnabled = false;
    

    where 'webView21' is the name of the WebView2 control.

    You can see all settings here: CoreWebView2Settings Class Definition