DesktopWindowXamlSource.GotFocus 事件

定義

發生于DesktopWindowXamlSource在傳統型應用程式中取得焦點時 (例如,當使用者將焦點放在DesktopWindowXamlSource) 之前的元素時,按下Tab鍵。

// Register
event_token GotFocus(TypedEventHandler<DesktopWindowXamlSource, DesktopWindowXamlSourceGotFocusEventArgs const&> const& handler) const;

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

// Revoke with event_revoker
DesktopWindowXamlSource::GotFocus_revoker GotFocus(auto_revoke_t, TypedEventHandler<DesktopWindowXamlSource, DesktopWindowXamlSourceGotFocusEventArgs const&> const& handler) const;
public event TypedEventHandler<DesktopWindowXamlSource,DesktopWindowXamlSourceGotFocusEventArgs> GotFocus;
function onGotFocus(eventArgs) { /* Your code */ }
desktopWindowXamlSource.addEventListener("gotfocus", onGotFocus);
desktopWindowXamlSource.removeEventListener("gotfocus", onGotFocus);
- or -
desktopWindowXamlSource.ongotfocus = onGotFocus;
Public Custom Event GotFocus As TypedEventHandler(Of DesktopWindowXamlSource, DesktopWindowXamlSourceGotFocusEventArgs) 

事件類型

備註

當您將 DesktopWindowXamlSource 新增至傳統型應用程式時, DesktopWindowXamlSource 預設不會透過 Tab 鍵或方向鍵等鍵盤事件自動處理焦點流覽。 呼叫 NavigateFocus 方法,以程式設計方式在使用者流覽至 DesktopWindowXamlSource時提供焦點。

處理當使用者透過某些非鍵盤事件進入DesktopWindowXamlSource時收到通知的GotFocus事件,例如按一下滑鼠,而且您想要讓主桌面應用程式中的 UI 狀態保持在最新狀態。

適用於