AppNotificationDuration 枚举
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
指定 AppNotification 的显示持续时间。
public enum class AppNotificationDuration
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilderContract, 65536)]
enum class AppNotificationDuration
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilderContract), 65536)]
public enum AppNotificationDuration
var value = Microsoft.Windows.AppNotifications.Builder.AppNotificationDuration.default
Public Enum AppNotificationDuration
- 继承
-
AppNotificationDuration
- 属性
字段
Default | 0 | 默认持续时间。 |
Long | 1 | 持续时间长。 |
示例
以下示例演示如何在应用通知的 XML 有效负载中设置持续时间。
var notification = new AppNotificationBuilder()
.AddText("Notification text.")
.SetDuration(AppNotificationDuration.Long)
.BuildNotification();
AppNotificationManager.Default.Show(notification);
生成的 XML 有效负载:
<toast duration='long'>
<visual>
<binding template='ToastGeneric'>
<text>Notification text.</text>
</binding>
</visual>
</toast>
注解
通过调用 AppNotificationBuilder.SetDuration 设置应用通知的持续时间。
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈