WindowActivatedEventHandler 代理人

定義

Activated イベントを処理するメソッドを表します。

public delegate void WindowActivatedEventHandler(Platform::Object ^ sender, WindowActivatedEventArgs ^ e);
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Guid(402809672, 34329, 19579, 181, 52, 206, 212, 93, 157, 226, 25)]
class WindowActivatedEventHandler : MulticastDelegate
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Guid(402809672, 34329, 19579, 181, 52, 206, 212, 93, 157, 226, 25)]
public delegate void WindowActivatedEventHandler(object sender, WindowActivatedEventArgs e);
Public Delegate Sub WindowActivatedEventHandler(sender As Object, e As WindowActivatedEventArgs)

パラメーター

sender
Object

Platform::Object

IInspectable

ハンドラーがアタッチされているオブジェクト。

e
WindowActivatedEventArgs

イベントのイベント データ。

属性

Windows の要件

デバイス ファミリ
Windows 10 (10.0.10240.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v1.0 で導入)

次のコード例は、このイベントの一般的な使用パターンを示しています。

void Current_Activated(object sender, Windows.UI.Core.WindowActivatedEventArgs e)
{
    if (e.WindowActivationState == 
        Windows.UI.Core.CoreWindowActivationState.Deactivated)
    {
        // Show the "paused" UI. 
        VisualStateManager.GoToState(this, "PauseUI", false);
    }
    else if (e.WindowActivationState == 
        Windows.UI.Core.CoreWindowActivationState.PointerActivated)
    {
        // Show the "active" UI. 
        VisualStateManager.GoToState(this, "ActivateUI", false);
    }
}

注釈

このイベントは、システムによって Window がアクティブ化または非アクティブ化されたときに発生します。 アプリでは、WindowActivatedEventArgs.WindowActivationState プロパティを確認することで、ウィンドウのアクティブ化の状態を確認できます。 ウィンドウは画面に表示できますが、アクティブにすることはできません。 さらに、システムの他の部分がウィンドウからフォーカスを取り除くと、このイベントが発生します。 これは、ユーザーの操作またはコードの結果として発生する可能性があり、 WindowActivationState は、実行されたアクションを示します。

ウィンドウのアクティブ化ではなく、アプリのアクティブ化には、独自の Activated イベントがあります。 詳細については、「 OnActivated 」または「 アプリのアクティブ化を処理する」を参照してください。

適用対象

こちらもご覧ください