WindowActivatedEventHandler WindowActivatedEventHandler WindowActivatedEventHandler WindowActivatedEventHandler Delegate


Represents the method that will handle the Activated event.

public : delegate void WindowActivatedEventHandler(Platform::Object sender, WindowActivatedEventArgs e)
struct WindowActivatedEventHandler : winrt::Windows::Foundation::IUnknown
   WindowActivatedEventHandler(std::nullptr_t = nullptr) noexcept;
   template <typename L> WindowActivatedEventHandler(L lambda);
   template <typename F> WindowActivatedEventHandler(F* function);
   template <typename O, typename M> WindowActivatedEventHandler(O* object, M method);
   void operator()(winrt::Windows::Foundation::IInspectable const& sender, winrt::Windows::UI::Core::WindowActivatedEventArgs const& e) const;
public delegate void WindowActivatedEventHandler(Object sender, WindowActivatedEventArgs e)
Public Delegate Sub WindowActivatedEventHandler(sender As Object, e As WindowActivatedEventArgs)


Object Object

The object where the handler is attached.


Windows 10 requirements

Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)


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 == 
        // Show the "paused" UI. 
        VisualStateManager.GoToState(this, "PauseUI", false);
    else if (e.WindowActivationState == 
        // Show the "active" UI. 
        VisualStateManager.GoToState(this, "ActivateUI", false);


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 Handle app activation.

See also