UIElement.GettingFocus 事件
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
// Register
event_token GettingFocus(TypedEventHandler<UIElement, GettingFocusEventArgs const&> const& handler) const;
// Revoke with event_token
void GettingFocus(event_token const* cookie) const;
// Revoke with event_revoker
UIElement::GettingFocus_revoker GettingFocus(auto_revoke_t, TypedEventHandler<UIElement, GettingFocusEventArgs const&> const& handler) const;
public event TypedEventHandler<UIElement,GettingFocusEventArgs> GettingFocus;
function onGettingFocus(eventArgs) { /* Your code */ }
uIElement.addEventListener("gettingfocus", onGettingFocus);
uIElement.removeEventListener("gettingfocus", onGettingFocus);
- or -
uIElement.ongettingfocus = onGettingFocus;
Public Custom Event GettingFocus As TypedEventHandler(Of UIElement, GettingFocusEventArgs)
<uiElement GettingFocus="eventhandler"/>
事件類型
備註
我們建議盡可能使用 UIElement 的焦點路由事件,而非 FocusManager 事件。
一次只能對一個 UI 元素進行聚焦。
當另一個控制項失去焦點、應用程式視圖改變、使用者切換應用程式,或使用者與系統互動使該應用程式不再處於前景時,控制器可能會獲得焦點。
在程式化地在元素間切換時, FocusNavigationDirection.Prior 和 FocusNavigationDirection.Next 無法與 FindNextElements Options 一起使用。 只有 FocusNavigationDirection.Up、 FocusNavigationDirection.Down、 FocusNavigationDirection.Left 或 FocusNavigationDirection.Right 是有效的。
GettingFocus 是一個路由事件。 欲了解更多路由事件概念,請參閱 事件與路由事件總覽。