WebViewControl.GotFocus WebViewControl.GotFocus WebViewControl.GotFocus WebViewControl.GotFocus WebViewControl.GotFocus Event


Informs your app when the WebViewControl receives focus (due to the user clicking inside/outside the WebViewControl). Use in combination with the LostFocus event and programmatic focus changes using the WebViewControl.MoveFocus method.

public : event TypedEventHandler<WebViewControl, object> GotFocus
// Register
event_token GotFocus(TypedEventHandler<WebViewControl, object> const& handler) const;

// Revoke with event_token
void GotFocus(event_token const& cookie) const;

// Revoke with event_revoker
GotFocus_revoker GotFocus(auto_revoke_t, TypedEventHandler<WebViewControl, object> const& handler) const;
public event TypedEventHandler<WebViewControl, object> GotFocus
Public Event GotFocus As TypedEventHandler (Of WebViewControl, object)
function onGotFocus(eventArgs){/* Your code */}

webViewControl.addEventListener("gotfocus", onGotFocus);
webViewControl.removeEventListener("gotfocus", onGotFocus);

Additional features and requirements

Device family
Windows 10, version 1809 (introduced v10.0.17763.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v7)


The following C# sample demonstrates an event using GotFocus and LostFocus with the WebViewControl:

WebViewControl webViewControl; 
void WebViewControlGotFocus(WebViewControl sender, IInspectable args) 
void WebViewControlLostFocus(WebViewControl sender, IInspectable args) 
webViewControl.GotFocus += WebViewControlGotFocus; 
webViewControl.LostFocus += WebViewControlLostFocus

The GotFocus and LostFocus event tell the app when WebViewControl receives or loses focus. This could be due to a call to MoveFocus, or due to the user clicking inside/outside the WebViewControl.