AppNotificationBuilder.SetDuration(AppNotificationDuration) Method
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.
Sets the duration for an app notification.
public:
virtual AppNotificationBuilder ^ SetDuration(AppNotificationDuration duration) = SetDuration;
AppNotificationBuilder SetDuration(AppNotificationDuration const& duration);
public AppNotificationBuilder SetDuration(AppNotificationDuration duration);
function setDuration(duration)
Public Function SetDuration (duration As AppNotificationDuration) As AppNotificationBuilder
Parameters
- duration
- AppNotificationDuration
A value from the AppNotificationDuration enumeration specifying the duration for the app notification.
Returns
Returns the AppNotificationBuilder instance so that additional method calls can be chained.
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
For guidance on using the AppNotificationBuilder APIs to create the UI for app notifications, see App notification content.
For reference information about the XML schema for app notifications, see App notification content schema.