FocusManager.GettingFocus イベント

定義

要素が実際にフォーカスを受け取る前に発生します。 このイベントは、イベントがバブルしている間にフォーカスが移動されないように同期的に発生します。

// Register
static event_token GettingFocus(EventHandler<GettingFocusEventArgs> const& handler) const;

// Revoke with event_token
static void GettingFocus(event_token const* cookie) const;

// Revoke with event_revoker
static FocusManager::GettingFocus_revoker GettingFocus(auto_revoke_t, EventHandler<GettingFocusEventArgs> const& handler) const;
public static event System.EventHandler<GettingFocusEventArgs> GettingFocus;
function onGettingFocus(eventArgs) { /* Your code */ }
Windows.UI.Xaml.Input.FocusManager.addEventListener("gettingfocus", onGettingFocus);
Windows.UI.Xaml.Input.FocusManager.removeEventListener("gettingfocus", onGettingFocus);
- or -
Windows.UI.Xaml.Input.FocusManager.ongettingfocus = onGettingFocus;
Public Shared Custom Event GettingFocus As EventHandler(Of GettingFocusEventArgs) 

イベントの種類

Windows の要件

デバイス ファミリ
Windows 10, version 1809 (10.0.17763.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v7.0 で導入)

注釈

可能な限り、FocusManager イベントではなく UIElement フォーカス ルーティング イベントを使用することをお勧めします。

FocusNavigationDirection.PreviousFocusNavigationDirection.NextFindNextElementOptions では使用できません。 FocusNavigationDirection.UpFocusNavigationDirection.DownFocusNavigationDirection.Left、または FocusNavigationDirection.Right のみが有効です。

UIElement フォーカス イベントは、次の順序で FocusManager にバブルアップします。

  1. UIElement.LosingFocus/FocusManager.LosingFocus
  2. UIElement.GettingFocus/FocusManager.GettingFocus
  3. UIElement.LostFocus ルーティング イベントは、フォーカスを失い、イベントがバブルアップした要素によって発生します
  4. FocusManager.LostFocus が発生します (ルーティング イベントが処理済みとしてマークされている場合でも)
  5. UIElement.GotFocus ルーティング イベントは、フォーカスを受け取った要素によって発生し、イベントはバブルアップします
  6. FocusManager.GotFocus が発生します (ルーティング イベントが処理済みとしてマークされている場合でも)

適用対象

こちらもご覧ください