WebView2.HasFocusWithinCore Method

Definition

This is overridden from HwndHost and is called when WPF needs to know if the focus is in our control/window. WPF can't know on its own since we're hosting a non-WPF window, so instead it asks us by calling this. To answer, we just track state based on CoreWebView2 events that fire when it gains or loses focus.

protected override bool HasFocusWithinCore ();
override this.HasFocusWithinCore : unit -> bool
Protected Overrides Function HasFocusWithinCore () As Boolean

Returns

True if the focus is in our control/window, false if it isn't.

Applies to