[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Collapse]Messages, Notifications and Dialogs
    XtraMessageBox
    Input Box
    XtraDialog
    Flyout Dialog
    Flyout Panel
   [Expand]Alert Windows
    Toast Notification Manager
    WinRTLiveTileManager
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Toast Notification Manager

The Toast Notification Manager component shows toast notifications - a Windows 10 version of alert windows.

Note

  • Toast notifications can only be displayed in Windows 8.0 or higher. For older Windows versions, use alert windows instead.
  • Windows displays toast notifications only for those apps that are pinned to the Start menu.

An application can display multiple notifications simultaneously, or one notification multiple times at once. The ToastNotification object has nine content templates, and can play a sound.

Expanded Create Notifications

Follow the steps below to create toast notifications.

  1. Locate the ToastNotificationManager component in Visual Studio's toolbox and drop it onto the form.

  2. Windows displays toast notifications only for those apps that are pinned to the Start menu, so make sure your application has a valid shortcut with an Application User Model ID. For debugging purposes, invoke the component's smart tag and click the "Create Application Shortcut" link.

  3. Invoke the manager's smart-tag and click the Edit Notifications... link.

  4. In the Collection Editor dialog, click Add to add a notification. This creates new ToastNotification objects and adds them to the manager's ToastNotificationsManager.Notifications collection. You can customize the notification settings in the property grid.

  5. To display a specific notification, use the ToastNotificationsManager.ShowNotification method.

Expanded Manage End-User Interactions

Depending on end user actions, the following events occur.

  • ToastNotificationsManager.Activated - occurs if an end user clicks this notification. Handle this event to check which notification was clicked, and perform actions depending on the result. The code below illustrates an example.
  • ToastNotificationsManager.UserCancelled - occurs if an end user closes the notification.
  • ToastNotificationsManager.TimedOut - occurs when an end user does not respond to the notification and the notification is hidden after a certain period. The code below re-sends timed out notifications.
  • ToastNotificationsManager.Hidden - occurs when a toast notification is hidden via the ToastNotificationsManager.HideNotification or ToastNotificationsManager.HideNotifications method.
  • ToastNotificationsManager.Dropped - fires when a notification is canceled due to end user's system settings.

Expanded Customize Notifications with the "Generic" Template

The following XML markup is a sample toast notification's content layout:

You can handle the ToastNotificationsManager.UpdateToastContent event to modify this template using the the System.XML namespace’s API. For instance, the following code adds a group with two subgroups to the notification layout. Each subgroup displays two additional text blocks, arranged vertically.

Expanded Buttons

Handle the following events to display a button in a notification:

The code below shows sample handlers.

Expanded Notes

  • The notification's background color is chosen automatically by the operating system, you cannot modify it manually.
  • The operating system displays notifications. They can remain visible after an end user closes the application.
  • Windows 8-style notifications automatically display a shortcut icon in the bottom-right corner. This icon cannot be removed.
  • The number of notifications that a visible simultaneously depends on the end user's system settings.
  • Windows 10 Anniversary Update (Redstone 1, build 1607) and newer versions support the Generic notification template.

Is this topic helpful?​​​​​​​