DesktopWindowXamlSource.GotFocus 事件
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
當 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(Microsoft)。UI。Xaml.Hosting.XamlSourceFocusNavigationRequest)方法,當使用者導航到 DesktopWindowXamlSource 時,程式化地賦予焦點。
處理 GotFocus 事件,當使用者透過非鍵盤事件(例如滑鼠點擊)進入 DesktopWindowXamlSource 時,會收到通知,並且你希望主機桌面應用程式的介面狀態是最新的。