InputActivationListener Class
Definition
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.
Provides the ability to access and observe changes to the activation state of an object.
public ref class InputActivationListener sealed : InputObject
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Foundation.WindowsAppSDKContract, 65537)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class InputActivationListener final : InputObject
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Foundation.WindowsAppSDKContract), 65537)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class InputActivationListener : InputObject
Public NotInheritable Class InputActivationListener
Inherits InputObject
- Inheritance
- Attributes
Examples
The following Windows App SDK example shows how to respond to activation events for an Microsoft.UI.Windowing.AppWindow object:
class RespondToAppWindowActivation
{
InputActivationListener inputActivationListener;
public RespondToAppWindowActivation(Microsoft.UI.Windowing.AppWindow appWindow)
{
inputActivationListener = InputActivationListener.GetForWindowId(appWindow.Id);
inputActivationListener.InputActivationChanged += OnActivationChanged;
}
void OnActivationChanged(
InputActivationListener sender,
InputActivationListenerActivationChangedEventArgs args)
{
if (sender.State == InputActivationState.Activated)
{
System.Diagnostics.Debug.WriteLine("AppWindow was activated.");
LeaveMyBackgroundMode();
}
else
{
System.Diagnostics.Debug.WriteLine("AppWindow was deactivated.");
EnterMyBackgroundMode();
}
}
}
Remarks
If the object associated with an InputActivationListener is destroyed, the InputActivationListener object will be implicitly disposed. See InputObject for more detail.
Properties
DispatcherQueue |
Gets the DispatcherQueue for the InputObject. (Inherited from InputObject) |
State |
Gets the activation state of the object. |
Methods
GetForIsland(ContentIsland) |
Retrieves an InputActivationListener object for the specified ContentIsland. |
GetForWindowId(WindowId) |
Retrieves a InputActivationListener object for the specified top-level window. |
Events
InputActivationChanged |
Occurs when the input activation state of the associated object changes. |
Applies to
See also
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for