FocusManager.LostFocus イベント

定義

コンテナー要素 (フォーカス スコープ) 内の要素がフォーカスを失ったときに発生します。 このイベントは非同期的に発生するため、バブルが完了する前にフォーカスが再び移動する可能性があります。

// Register
static event_token LostFocus(EventHandler<FocusManagerLostFocusEventArgs> const& handler) const;

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

// Revoke with event_revoker
static FocusManager::LostFocus_revoker LostFocus(auto_revoke_t, EventHandler<FocusManagerLostFocusEventArgs> const& handler) const;
public static event System.EventHandler<FocusManagerLostFocusEventArgs> LostFocus;
function onLostFocus(eventArgs) { /* Your code */ }
Windows.UI.Xaml.Input.FocusManager.addEventListener("lostfocus", onLostFocus);
Windows.UI.Xaml.Input.FocusManager.removeEventListener("lostfocus", onLostFocus);
- or -
Windows.UI.Xaml.Input.FocusManager.onlostfocus = onLostFocus;
Public Shared Custom Event LostFocus As EventHandler(Of FocusManagerLostFocusEventArgs) 

イベントの種類

Windows の要件

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

注釈

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

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

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

適用対象

こちらもご覧ください