public bool MoveFocus(WEBVIEW2_MOVE_FOCUS_REASON reason) { if (_webView2WebView == null) { return(false); } _webView2WebView.MoveFocus(reason); return(true); }
/// <summary> /// Register a handler for the MoveFocusRequested event. /// This event will be fired when the user tabs out of the webview. /// The handler will focus another window in the app, depending on which /// direction the focus is being shifted. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void WebView2MoveFocusRequested(object sender, Wrapper.MoveFocusRequestedEventArgs e) { if (!_parent.AutoTabHandle) { WEBVIEW2_MOVE_FOCUS_REASON reason = e.Reason; if (reason == WEBVIEW2_MOVE_FOCUS_REASON.WEBVIEW2_MOVE_FOCUS_REASON_NEXT) { _parent.SelectNextControl(_webView2); } else if (reason == WEBVIEW2_MOVE_FOCUS_REASON.WEBVIEW2_MOVE_FOCUS_REASON_PREVIOUS) { _parent.SelectNextControl(_webView2); } e.Handled = true; } }