InputLightDismissAction 类

定义

基于检测当前窗口外部或特定键盘输入的任何位置的交互事件,启用当前窗口的关闭。

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
继承
Object Platform::Object IInspectable InputObject InputLightDismissAction
属性

示例

以下示例演示如何创建上下文菜单样式, Microsoft.UI.Windowing.AppWindow 并在引发浅色消除事件时将其关闭。

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

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

注解

触发轻量消除的操作示例包括:

  • 窗口将失去激活。
  • 当用户在窗口具有焦点时按“escape”键。
  • 当用户在窗口具有焦点时按“alt”键。
  • 窗口接收应用命令,例如 APPCOMMAND_BROWSER_HOMEAPPCOMMAND_BROWSER_BACKWARDAPPCOMMAND_BROWSER_FORWARDAPPCOMMAND_BROWSER_REFRESH
  • 窗口接收消息 WM_HOTKEY

如果销毁了与 InputLightDismissAction 关联的窗口,则将隐式释放 InputLightDismissAction 对象。 有关更多详细信息,请参阅 InputObject

属性

DispatcherQueue

获取 InputObject 的 DispatcherQueue

(继承自 InputObject)

方法

GetForWindowId(WindowId)

检索指定窗口的 InputLightDismissAction 对象。

事件

Dismissed

当用户在关联窗口外点击或单击时发生。

适用于