Partager via


WebView2.OnGotKeyboardFocus(KeyboardFocusChangedEventArgs) Method

Definition

This is overridden from UIElement and is called to inform us when we receive the keyboard focus. We handle this by passing the keyboard focus on to the underlying CoreWebView2. We never want to land in a state where our window (this.Handle) actually has the keyboard focus.

protected override void OnGotKeyboardFocus (System.Windows.Input.KeyboardFocusChangedEventArgs e);
override this.OnGotKeyboardFocus : System.Windows.Input.KeyboardFocusChangedEventArgs -> unit
Protected Overrides Sub OnGotKeyboardFocus (e As KeyboardFocusChangedEventArgs)

Parameters

e
KeyboardFocusChangedEventArgs

Arguments from the underlying GotKeyboardFocus event.

Remarks

Note that it's actually possible for us to receive keyboard focus without this method being called. One known case where that happens is when our parent window is deactivated while we have focus, then reactivated. We handle that case in WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean).

Applies to

See also