ToastNotificationManager ToastNotificationManager ToastNotificationManager ToastNotificationManager ToastNotificationManager Class


Creates ToastNotifier objects that you use to raise toast notifications. This class also provides access to the XML content of the system-provided toast templates so that you can customize that content for use in your notifications.

public : static class ToastNotificationManager
static struct winrt::Windows::UI::Notifications::ToastNotificationManager
public static class ToastNotificationManager
Public Shared Class ToastNotificationManager
// This class does not provide a public constructor.

Windows 10 requirements

Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)


The following example shows how to create and send a toast notification that includes text and images, including the use of the GetTemplateContent and CreateToastNotifier methods.

var notifications = Windows.UI.Notifications;

// Get the toast notification manager for the current app.
var notificationManager = notifications.ToastNotificationManager;

// The getTemplateContent method returns a Windows.Data.Xml.Dom.XmlDocument object
// that contains the toast notification XML content.
var template = notifications.toastTemplateType.toastImageAndText01;
var toastXml = notificationManager.getTemplateContent(notifications.ToastTemplateType[template]);

// You can use the methods from the XML document to specify the required elements for the toast.
var images = toastXml.getElementsByTagName("image");
images[0].setAttribute("src", "images/toastImageAndText.png");

var textNodes = toastXml.getElementsByTagName("text");
textNodes.forEach(function (value, index) {
    var textNumber = index + 1;
    var text = "";
    for (var j = 0; j < 10; j++) {
        text += "Text input " + /*@static_cast(String)*/textNumber + " ";

// Create a toast notification from the XML, then create a ToastNotifier object
// to send the toast.
var toast = new notifications.ToastNotification(toastXml);



Sending toast notifications from desktop apps

Generally, sending a toast notification from a desktop app is the same as sending it from a UWP app. However, you should be aware of these differences and requirements:

  • For a desktop app to display a toast, the app must have a shortcut on the Start screen.
  • The shortcut must have an AppUserModelID.
  • Desktop apps cannot schedule a toast.

For more information, see these topics:

Version history

Windows version SDK version Value added
1607 14393 ConfigureNotificationMirroring
1607 14393 GetForUser
1703 15063 GetDefault


History History History History History

Gets the ToastNotificationHistory object.


ConfigureNotificationMirroring(NotificationMirroring) ConfigureNotificationMirroring(NotificationMirroring) ConfigureNotificationMirroring(NotificationMirroring) ConfigureNotificationMirroring(NotificationMirroring) ConfigureNotificationMirroring(NotificationMirroring)

Specifies whether notification mirroring is allowed. Notification mirroring enables a notification to be broadcast on multiple devices.

CreateToastNotifier() CreateToastNotifier() CreateToastNotifier() CreateToastNotifier() CreateToastNotifier()

Creates and initializes a new instance of the ToastNotification, bound to the calling application, that lets you raise a toast notification to that app.

CreateToastNotifier(String) CreateToastNotifier(String) CreateToastNotifier(String) CreateToastNotifier(String) CreateToastNotifier(String)

Creates and initializes a new instance of the ToastNotification, bound to a specified app, usually another app in the same package.

GetDefault() GetDefault() GetDefault() GetDefault() GetDefault()

Gets a toast notification manager for the current user.

GetForUser(User) GetForUser(User) GetForUser(User) GetForUser(User) GetForUser(User)

Gets a toast notification manager for the specified user.

GetTemplateContent(ToastTemplateType) GetTemplateContent(ToastTemplateType) GetTemplateContent(ToastTemplateType) GetTemplateContent(ToastTemplateType) GetTemplateContent(ToastTemplateType)

Gets the XML content of one of the predefined toast templates so that you can customize it for use in your notification.

See also