How can I disable the developer tools for a Maui WebView control ? With Xamarin WebView2 it is quite easy with CoreWebView2.Settings.AreDevToolsEnabled.
In fact, I believe at least on Windows, the Maui WebView is based on CoreWebView2. Is there a way to access the CoreWebView2.Settings directly ?
Thanks,
Well ... I did find a solution. It seems to be a question of setting the AreBrowserAcceleratorKeysEnabled at the correct time.
Not ideal, but setting the first time a Navigating event is called works. (perhaps someone knows a better way to do this)
WebView wv = new WebView();
wv.Navigating += Wv_Navigating ;
private void Wv_Navigating(object sender, WebNavigatingEventArgs e)
{
WebView webview = (WebView)sender;
CoreWebView2 coreWebView2 = (webview.Handler.PlatformView as Microsoft.UI.Xaml.Controls.WebView2).CoreWebView2;
coreWebView2.Settings.AreDevToolsEnabled = false;
webview.Navigating -= Wv_Navigating;
}