Share via


InputLightDismissAction Class

Definition

Enables dismissal of the current window based on the detection of interaction events anywhere outside of the current window or from specific keyboard input.

public ref class InputLightDismissAction sealed : InputObject
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Foundation.WindowsAppSDKContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class InputLightDismissAction final : InputObject
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Foundation.WindowsAppSDKContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class InputLightDismissAction : InputObject
Public NotInheritable Class InputLightDismissAction
Inherits InputObject
Inheritance
Object Platform::Object IInspectable InputObject InputLightDismissAction
Attributes

Examples

The following example shows how to create a context-menu-styled Microsoft.UI.Windowing.AppWindow and close it when the light dismiss event is raised.

AppWindow appWindow = AppWindow.Create(AppWindowConfiguration.CreateForContextMenu());
appWindow.Show();

InputLightDismissAction inputLightDismissAction = InputLightDismissAction.GetForWindowId(appWindow.Id);
inputLightDismissAction.Dismissed += (sender, args) => appWindow.Destroy();

Remarks

Examples of actions that trigger a light dismiss include:

  • The window loses activation.
  • The user presses the 'escape' key while the window has focus.
  • The user presses the 'alt' key while the window has focus.
  • The window receives app commands such as APPCOMMAND_BROWSER_HOME, APPCOMMAND_BROWSER_BACKWARD, APPCOMMAND_BROWSER_FORWARD, or APPCOMMAND_BROWSER_REFRESH.
  • The window receives a WM_HOTKEY message.

If the window associated with an InputLightDismissAction is destroyed, the InputLightDismissAction object will be implicitly disposed. See InputObject for more detail.

Properties

DispatcherQueue

Gets the DispatcherQueue for the InputObject.

(Inherited from InputObject)

Methods

GetForWindowId(WindowId)

Retrieves the InputLightDismissAction object for the specified window.

Events

Dismissed

Occurs when the user taps or clicks outside of the associated window.

Applies to