AppNotificationBuilder.SetScenario(AppNotificationScenario) 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 scenario for the app notification, which causes the system to adjust some of the notification behaviors to present a consistent experience for the specified scenario.
public:
virtual AppNotificationBuilder ^ SetScenario(AppNotificationScenario value) = SetScenario;
AppNotificationBuilder SetScenario(AppNotificationScenario const& value);
public AppNotificationBuilder SetScenario(AppNotificationScenario value);
function setScenario(value)
Public Function SetScenario (value As AppNotificationScenario) As AppNotificationBuilder
Parameters
- value
- AppNotificationScenario
A value from the AppNotificationScenario enumeration specifying the scenario for the app notification.
Returns
Returns the AppNotificationBuilder instance so that additional method calls can be chained.
Examples
The following example demonstrates setting the notification scenario in the XML payload for an app notification.
var notification = new AppNotificationBuilder()
.AddText("Notification text.")
.SetScenario(AppNotificationScenario.Reminder)
.BuildNotification();
AppNotificationManager.Default.Show(notification);
The resulting XML payload:
<toast scenario='reminder'>
<visual>
<binding template='ToastGeneric'>
<text>Notification text.</text>
</binding>
</visual>
</toast>
Remarks
The Urgent scenario value is only supported for on Windows 10 Build 19041 and later. Call IsUrgentScenarioSupported to determine at runtime if the urgent scenario is supported on the current device.
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.