WebViewControl.GotFocus Event
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.
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.
// Register
event_token GotFocus(TypedEventHandler<WebViewControl, IInspectable const&> const& handler) const;
// Revoke with event_token
void GotFocus(event_token const* cookie) const;
// Revoke with event_revoker
WebViewControl::GotFocus_revoker GotFocus(auto_revoke_t, TypedEventHandler<WebViewControl, IInspectable const&> const& handler) const;
public event TypedEventHandler<WebViewControl,object> GotFocus;
function onGotFocus(eventArgs) { /* Your code */ }
webViewControl.addEventListener("gotfocus", onGotFocus);
webViewControl.removeEventListener("gotfocus", onGotFocus);
- or -
webViewControl.ongotfocus = onGotFocus;
Public Custom Event GotFocus As TypedEventHandler(Of WebViewControl, Object)
Event Type
TypedEventHandler<WebViewControl,IInspectable>
Windows requirements
Device family |
Windows 10, version 1809 (introduced in 10.0.17763.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v7.0)
|
Examples
The following C# sample demonstrates an event using GotFocus and LostFocus with the WebViewControl:
WebViewControl webViewControl;
void WebViewControlGotFocus(WebViewControl sender, IInspectable args)
{
AddFocusHighlightToElement(sender);
}
void WebViewControlLostFocus(WebViewControl sender, IInspectable args)
{
RemoveFocusHighlightFromElement(sender);
}
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.