AppNotificationScenario Enum

Definition

Specifies the scenario for an app notification, which causes the system to adjust some of the notification behaviors to present a consistent experience for the specified scenario.

public enum class AppNotificationScenario
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilderContract, 65536)]
enum class AppNotificationScenario
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilderContract), 65536)]
public enum AppNotificationScenario
var value = Microsoft.Windows.AppNotifications.Builder.AppNotificationScenario.default
Public Enum AppNotificationScenario
Inheritance
AppNotificationScenario
Attributes

Fields

Alarm 2

The alarm scenario.

Default 0

The default scenario.

IncomingCall 3

The incoming call scenario.

Reminder 1

The reminder scenario.

Urgent 4

The urgent scenario.

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

Set the scenario for an app notification XML payload by calling AppNotificationBuilder.SetScenario.

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.

Applies to