Bagikan melalui


WebViewControl.LostFocus Kejadian

Definisi

Menginformasikan aplikasi Anda saat WebViewControl kehilangan fokus. Dapat dimulai oleh pengguna yang mengklik di dalam/di luar WebViewControl atau dengan perubahan fokus terprogram, seperti aplikasi memanggil SetFocus pada jendela yang bukan panggilan metode WebViewControl atau MoveFocus .

// Register
event_token LostFocus(TypedEventHandler<WebViewControl, IInspectable const&> const& handler) const;

// Revoke with event_token
void LostFocus(event_token const* cookie) const;

// Revoke with event_revoker
WebViewControl::LostFocus_revoker LostFocus(auto_revoke_t, TypedEventHandler<WebViewControl, IInspectable const&> const& handler) const;
public event TypedEventHandler<WebViewControl,object> LostFocus;
function onLostFocus(eventArgs) { /* Your code */ }
webViewControl.addEventListener("lostfocus", onLostFocus);
webViewControl.removeEventListener("lostfocus", onLostFocus);
- or -
webViewControl.onlostfocus = onLostFocus;
Public Custom Event LostFocus As TypedEventHandler(Of WebViewControl, Object) 

Jenis Acara

Persyaratan Windows

Rangkaian perangkat
Windows 10, version 1809 (diperkenalkan dalam 10.0.17763.0)
API contract
Windows.Foundation.UniversalApiContract (diperkenalkan dalam v7.0)

Contoh

Sampel C# berikut menunjukkan peristiwa menggunakan GotFocus dan LostFocus dengan 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

Peristiwa GotFocus dan LostFocus memberi tahu aplikasi saat WebViewControl menerima atau kehilangan fokus. Ini bisa disebabkan oleh panggilan ke MoveFocus, atau karena pengguna mengklik di dalam/di luar WebViewControl.

Berlaku untuk