ToastContent Class

Definition

Base Toast element, which contains at least a visual element.

public sealed class ToastContent : Microsoft.Toolkit.Uwp.Notifications.INotificationContent
type ToastContent = class
    interface INotificationContent
Public NotInheritable Class ToastContent
Implements INotificationContent
Inheritance
ToastContent
Implements

Constructors

ToastContent()

Properties

Actions

Gets or sets optional custom actions with buttons and inputs (using ToastActionsCustom) or optionally use the system-default snooze/dismiss controls (with ToastActionsSnoozeAndDismiss).

ActivationOptions

Gets or sets additional options relating to activation of the toast notification. Requires Creators Updated

ActivationType

Gets or sets what activation type will be used when the user clicks the body of this Toast.

AdditionalProperties

Gets a dictionary where you can assign additional properties.

Audio

Gets or sets custom audio options.

DisplayTimestamp

Gets or sets an optional custom time to use for the notification's timestamp, visible within Action Center. If provided, this date/time will be used on the notification instead of the date/time that the notification was received. Requires Creators Update

Duration

Gets or sets the amount of time the Toast should display. You typically should use the Scenario attribute instead, which impacts how long a Toast stays on screen.

Header

Gets or sets an optional header for the toast notification. Requires Creators Update

HintPeople

Gets or sets the person that this toast is related to. For more info, see the My People documentation. New in Fall Creators Update.

HintToastId

Gets or sets an identifier used in telemetry to identify your category of toast notification. This should be something like "NewMessage", "AppointmentReminder", "Promo30Off", or "PleaseRate". In the upcoming toast telemetry dashboard in Dev Center, you will be able to view activation info filtered by toast identifier.

Launch

Gets or sets a string that is passed to the application when it is activated by the Toast. The format and contents of this string are defined by the app for its own use. When the user taps or clicks the Toast to launch its associated app, the launch string provides the context to the app that allows it to show the user a view relevant to the Toast content, rather than launching in its default way.

Scenario

Gets or sets the scenario, to make the Toast behave like an alarm, reminder, or more.

Visual

Gets or sets the visual element (Required).

Methods

GetContent()

Retrieves the notification XML content as a string, so that it can be sent with a HTTP POST in a push notification.

GetXml()

Retrieves the notification XML content as a WinRT XmlDocument, so that it can be used with a local Toast notification's constructor on either Windows.UI.Notifications.ToastNotification or Windows.UI.Notifications.ScheduledToastNotification.

Applies to