WebViewControl.GotFocus Ereignis

Definition

Informiert Ihre App, wenn webViewControl den Fokus erhält (weil der Benutzer innerhalb/außerhalb von WebViewControl klickt). Verwenden Sie in Kombination mit dem LostFocus-Ereignis und programmgesteuerten Fokusänderungen mithilfe der WebViewControl.MoveFocus-Methode .

// 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) 

Ereignistyp

Windows-Anforderungen

Gerätefamilie
Windows 10, version 1809 (eingeführt in 10.0.17763.0)
API contract
Windows.Foundation.UniversalApiContract (eingeführt in v7.0)

Beispiele

Im folgenden C#-Beispiel wird ein Ereignis mit GotFocus und LostFocus mit WebViewControl veranschaulicht:

WebViewControl webViewControl; 

void WebViewControlGotFocus(WebViewControl sender, IInspectable args) 
{ 
    AddFocusHighlightToElement(sender); 
} 

void WebViewControlLostFocus(WebViewControl sender, IInspectable args) 
{ 
    RemoveFocusHighlightFromElement(sender); 
} 

webViewControl.GotFocus += WebViewControlGotFocus; 
webViewControl.LostFocus += WebViewControlLostFocus

Das GotFocus- und LostFocus-Ereignis teilt der App mit, wenn WebViewControl den Fokus empfängt oder verliert. Dies kann auf einen Aufruf von MoveFocus oder darauf zurückzuführen sein, dass der Benutzer innerhalb/außerhalb von WebViewControl klickt.

Gilt für: