WindowActivatedEventHandler delegate

Applies to Windows and Windows Phone

Represents the method that will handle the Activated event.

Syntax


public delegate void WindowActivatedEventHandler(
  Object^ sender, 
  WindowActivatedEventArgs e
)

Attributes

[Version(0x06020000)]
[WebHostHidden()]

Parameters

sender

Type: System.Object [.NET] | Platform::Object [C++]

The object where the handler is attached.

e

Type: WindowActivatedEventArgs

Event data for the event.

Remarks

This event occurs when a Window has been activated or deactivated by the system. An app can determine what the status of the Window activation is by checking the WindowActivatedEventArgs.WindowActivationState property. A Window could be visible on screen but not be active. Additionally, if any other parts of the system takes focus away from the window, this event will occur. This could happen as a result of user interaction or code, and the WindowActivationState will indicate which action has taken place.

App activation as opposed to Window activation has its own Activated event. For more info, see OnActivated or How to activate an app.

Examples

The following code example demonstrates a typical usage pattern for this event.


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);
    }
}


Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml
Windows::UI::Xaml [C++]

Metadata

Windows.winmd

See also

Window

 

 

Show:
© 2014 Microsoft