WindowActivatedEventHandler Delegate
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
The object where the handler is attached.
Event data for the event.
- Attributes
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
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);
}
}
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.
Product | Versions |
---|---|
WinRT | Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100 |