Share via


WebViewControl.GotFocus 이벤트

정의

WebViewControl이 포커스를 받을 때(사용자가 WebViewControl 내부/외부를 클릭하기 때문에) 앱에 알릴 수 있습니다. WebViewControl.MoveFocus 메서드를 사용하여 LostFocus 이벤트 및 프로그래밍 방식 포커스 변경 내용과 함께 사용합니다.

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

이벤트 유형

Windows 요구 사항

디바이스 패밀리
Windows 10, version 1809 (10.0.17763.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v7.0에서 도입되었습니다.)

예제

다음 C# 샘플에서는 WebViewControl과 함께 GotFocus 및 LostFocus를 사용하는 이벤트를 보여 줍니다.

WebViewControl webViewControl; 

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

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

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

GotFocus 및 LostFocus 이벤트는 WebViewControl이 포커스를 받거나 잃을 때 앱을 알려줍니다. MoveFocus 호출 또는 사용자가 WebViewControl 내부/외부를 클릭하기 때문일 수 있습니다.

적용 대상