Skip to main content
ToastNotification.Dismissed | dismissed event

Occurs when a toast notification leaves the screen, either by expiring or being explicitly dismissed by the user. Apps that are running subscribe to this event.

Syntax


function onDismissed(eventArgs) { /* Your code */ }
 
// addEventListener syntax
toastNotification.addEventListener("dismissed", onDismissed);
toastNotification.removeEventListener("dismissed", onDismissed);
 
- or -

toastNotification.ondismissed = onDismissed;

public event TypedEventHandler<ToastNotification, ToastDismissedEventArgs> Dismissed

Public Event Dismissed As TypedEventHandler(Of ToastNotification, ToastDismissedEventArgs)

public:
event TypedEventHandler<ToastNotification, ToastDismissedEventArgs>^ Dismissed {
   Windows::Foundation::EventRegistrationToken add(TypedEventHandler<ToastNotification, ToastDismissedEventArgs>^ value);
   void remove(Windows::Foundation::EventRegistrationToken token);
}

Event information

Delegate TypedEventHandler<ToastNotification, ToastDismissedEventArgs>

Remarks

The ToastDismissalReason is included in the ToastDismissedEventArgs parameter.

Examples

The following example shows how to listen for and handle the Dismissed event.


var notifications = Windows.UI.Notifications;

yourToastNotification.addEventListener("dismissed", function (e) {
    switch (e.reason) {
        case notifications.ToastDismissalReason.applicationHidden:
            // The application hid the toast using ToastNotifier.hide.
            break;
        case notifications.ToastDismissalReason.userCanceled:
            // The user dismissed the toast.
            break;
        case notifications.ToastDismissalReason.timedOut:
            // The toast has expired.
            break;
    }
}

Requirements ( device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.UI.Notifications
Windows::UI::Notifications [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (operating system)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.UI.Notifications
Windows::UI::Notifications [C++]

Metadata

Windows.winmd

See also

ToastDismissedEventArgs
ToastNotification
Toast notifications sample
Sending toast notifications from desktop apps sample
Toast XML schema
Toast notification overview
Quickstart: Sending a toast notification
Quickstart: Sending a toast push notification
Quickstart: Sending a toast notification from the desktop
Guidelines and checklist for toast notifications
How to handle activation from a toast notification
How to opt in for toast notifications
How to schedule a toast notification
How to enable desktop toast notifications through an AppUserModelID
The toast template catalog
Toast audio options