AppNotificationDuration Enum

Definition

Specifies the duration for which an AppNotification is displayed.

C#
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilderContract), 65536)]
public enum AppNotificationDuration
Inheritance
AppNotificationDuration
Attributes

Fields

Name Value Description
Default 0

The default duration.

Long 1

Long duration.

Examples

The following example demonstrates setting the duration in the XML payload for an app notification.

C#
var notification = new AppNotificationBuilder()
    .AddText("Notification text.")
    .SetDuration(AppNotificationDuration.Long)
    .BuildNotification();

AppNotificationManager.Default.Show(notification);

The resulting XML payload:

XML
<toast duration='long'>
    <visual>
        <binding template='ToastGeneric'>
            <text>Notification text.</text>
        </binding>
    </visual>
</toast>

Remarks

Set the duration for an app notification by calling AppNotificationBuilder.SetDuration).

Applies to

Product Versions
Windows App SDK 1.2, 1.3, 1.4, 1.5, 1.6