private void OnWebViewCreated(CreateWebViewCompletedEventArgs args) { int result = args.Result; WebView2WebView webView = args.WebView; if (webView != null) { _webView2WebView = webView; } RegisterHandlers(); // Resize WebView to fit the bounds of the parent window _webView2WebView.Bounds = new Rectangle(new Point(0, 0), Size); // Set any properties that we have cached because the browser wasn't created yet AreDevToolsEnabled = _initialAreDevToolsEnabled; ZoomFactor = _initialZoomFactor; OnBrowserCreated(EventArgs.Empty); if (!string.IsNullOrEmpty(_internalUrl)) { _webView2WebView.Navigate(_internalUrl); } }