Tag Archives: Toast Notifications

Scheduling Toast Notifications

You can schedule a toast to appear any time in the future—you supply a time
at which you want the toast notification to appear, and it shows up on demand.
Your application doesn’t even have to be running! In order to better manage
your toasts, however, you should set the Id property of the toast to a string of
up to 16 characters. Having an ID allows you to refer to the toast (and possibly
cancel it).

Note that all the previous examples have used a ToastNotifier instance, but
haven’t stored a reference to it for later use. The ToastNotifier class provides
several useful methods, and if you plan to work with toast notifications after
they’re created, you will need to create a specific reference to a ToastNotifier
instance to work with. Specifically, the ToastNotifier class provides these

  • AddToSchedule, RemoveFromSchedule
  • Show (which you previously called), Hide
  • GetScheduledToastNotifications

To create a scheduled notification, start by creating an instance of the
ScheduledToastNotification class. To its constructor, pass the XML content of
a ToastContent instance—you can use the GetXml method to retrieve the
XML content. Next, create the ToastNotifier instance, and call its
AddToSchedule method, supplying the ScheduledToastNotification instance as
a parameter. In addition, supply the time at which you want to display the


You cannot schedule more than 4096 notifications. Also note that
you cannot schedule a notification in the past (in other words, you
can’t break the inviolable laws of the space-time continuum).

Creating a Recurring Notification
To create a recurring notification, follow the exact same steps as for a
scheduled notification, except that you must also specify the snooze interval
(that is, how long to wait before reattempting the notification), which can be a
value between 60 seconds and 60 minutes. Also, specify the maximum occurrences
of the notification (a value between 1 and 5).

TIP: Specify an Id property when creating scheduled and/or recurring toast
notifications. Doing so will make it easier to identify notifications when
reviewing or cancelling them.


This post is an excerpt from the online courseware for ourWindows 8 Using XAML: Views, Resources, and Toastscourse written by expert Ken Getz.

Ken Getz is a Visual Studio expert with over 25 years of experience as a successful developer and consultant. He is a nationally recognized author and speaker, as well as a featured instructor for LearnNowOnline.

Investigating Toast Notifications

Toast notifications are simple notifications that appear in the upper-right
corner of the screen (upper-left corner for right-to-left languages); when they
appear, they play a default sound. Toast notifications allow apps to
communicate with users even if the user is using another app, on the Start
screen, or on the Windows desktop. Actually, toast notifications are most
useful when the user isn’t working with the app that raised the notifications—
clicking the toast redirects the user back to the app that raised the notification, and optionally (and really should) take the user to the specific part of the
application that needs attention. Toast notifications can originate from a
Windows Store app, from a desktop app, or from the cloud.

Investigating Toast Notifications

Toast notifications can contain text and, optionally, an image. Clicking the
toast returns you to the calling application. You cannot add any other user
interface elements (like buttons)—you can include text and maybe an image,
and that’s it!

Your toast notifications can play a sound as they display, and you can select
the sound from a list of available Windows sounds. The toast appears in the
upper-right corner of the screen, and can be activated, dismissed, or ignored by
the user.

If the user clicks or taps on the toast, Windows launches the associated
application. Users expect that the current view in the newly launched app
corresponds with the information on the toast—if the toast indicates a new
email message, for example, users expect that tapping the toast notification
displays the application with the new email message selected. To make this
possible, you can specify context information in the toast to pass through to the
application to set the context for the newly launched application.

Think of it this way: Toast notifications provide the only means of interrupting
the user’s activity in one app with information from another.

You should only use toast notifications for information that’s of high interest
to the user. Perhaps your application requires some sort of user opt-in: look at
a new email message, or respond to an IM message? These are both common
uses for toast notifications. Remember: because of settings, or because the user
is busy, the user may never see your toast notification.

Different Types of Toast Notifications

Windows 8 provides two distinct types of toasts. The first, the standard toast
notification, remains on the screen for seven seconds, and then disappears.
(The user can click or tap the notification to navigate back to the original app
during the time it’s on screen.) The toast displays a brief sound to alert the
user, although you can alter the sound, or play nothing at all. This type of toast
is best for things like a social media update, or an IM sign-in. Given the two
options, this is the type of toast you should use in most situations. (This is the
default toast type, as well.)

The second type of toast is the long-duration toast. It looks the same as the
standard toast, but it remains on the screen for 25 seconds, unless the user
dismisses it. You can optionally make the long-duration toast stay on screen
longer, and you can loop audio. Imagine that your application connects a VOIP
call, and you need to alert the user that there’s an incoming call. You need the
toast notification to continue ringing, and stay visible, until the caller hangs
up—that may take longer than 25 seconds. Use the long-duration toast
notification when you want to grab the user’s attention because a human is
waiting for the user’s attention.

In addition to the two basic toast types, you can also create scheduled and
recurring toast notifications. Toast notifications can be scheduled to appear at a
specific time, and this usage is helpful for alarms, calendar reminders, and
precise timing-based notifications. You can also display the toast notification
multiple times (although this usage can be irritating)—this increases the user’s
chance of seeing the toast notification. Scheduled toast notifications require
you to specify the date and time at which the toast should appear.

ldn-expertkgetzKen Getz is a Visual Studio expert with over 25 years of experience as a successful developer and consultant. He is a nationally recognized author and speaker, as well as a featured instructor for LearnNowOnline. This post is an excerpt from the online courseware for our Windows 8 Using XAML: Views, Resources, and Toastscourse written by expert Ken Getz.