Szerkesztés

Megosztás a következőn keresztül:


toast (Toast XML Schema)

Base toast element, which contains at least a single visual element.

Element hierarchy

<toast>

Syntax

<toast launch?   = string
      duration? = "long" | "short" 
      displayTimeStamp? = string
      scenario? = "reminder" | "alarm" | "incomingCall" | "urgent" 
      useButtonStyle? = boolean>

  <!-- Child elements -->
  visual,
  audio?,
  commands?
  actions?
  header?
</toast>

Key

?   optional (zero or one)

Attributes and Elements

Attributes

Attribute Description Data type Required Default value
duration

The amount of time the toast should display.

This attribute can have one of the following values:

  • long
  • short
No None
launch

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.

string No None
displayTimestamp

Introduced in Creators Update: Overrides the default timestamp with a custom timestamp representing when your notification content was actually delivered, rather than the time the notification was received by the Windows platform. This value must be a string formatted using the ISO 8601 standard.

string No None
scenario

The scenario your toast is used for, like an alarm or reminder.

  • "reminder" - A reminder notification. This will be displayed pre-expanded and stay on the user's screen till dismissed. Note that this will be silently ignored unless there's a toast button action that activates in background.
  • "alarm" - An alarm notification. This will be displayed pre-expanded and stay on the user's screen till dismissed. Audio will loop by default and will use alarm audio.
  • "incomingCall" - An incoming call notification. This will be displayed pre-expanded in a special call format and stay on the user's screen till dismissed. Audio will loop by default and will use ringtone audio.
  • "urgent" - An important notification. This allows users to have more control over what apps can send them high-priority toast notifications that can break through Focus Assist (Do not Disturb). This can be modified in the notifications settings.

string No None
useButtonStyle

Specifies whether styled buttons should be used. The styling of the button is determined by the **hint-buttonStyle** attribute of the action element.

boolean No false

 

Child Elements

Child Element Description
audio

Specifies a sound to play when a toast notification is displayed. This element also allows you to mute any toast notification audio.

commands

Specifies that the toast notification is being used to indicate an incoming call or an alarm, with appropriate commands associated with each scenario.

visual

Contains a single binding element that defines a toast.

actions

Container element for declaring up to five inputs and up to five button actions for the toast notification.

header

Introduced in Creators Update. Specifies a custom header that groups multiple notifications together within Action Center.

 

Parent Elements

This outermost (document) element may not be contained by any other elements.

See also