AppNotificationDuration Enum
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.
Specifies the duration for which an AppNotification is displayed.
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
- 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.
var notification = new AppNotificationBuilder()
.AddText("Notification text.")
.SetDuration(AppNotificationDuration.Long)
.BuildNotification();
AppNotificationManager.Default.Show(notification);
The resulting XML payload:
<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).