WebView2.HasFocusWithinCore Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.