sasias
sasias

Reputation: 11

How to remove a scheduled toast notification

I knew how to do scheduled toast notification from this sample http://code.msdn.microsoft.com/windowsapps/Schedules-Toast-notificatio-457e599b#content

but now what I want to do is knowing how to remove the toast that has been created I tried this code but it's not working

IReadOnlyList<ScheduledToastNotification> scheduled =
    ToastNotificationManager.CreateToastNotifier().GetScheduledToastNotifications();

foreach (ScheduledToastNotification notify in scheduled)
{
    if (notify.Id == id)
    {
        ToastNotificationManager.CreateToastNotifier().RemoveFromSchedule(notify);
    }
}

Upvotes: 1

Views: 3636

Answers (2)

Colin Kiama
Colin Kiama

Reputation: 79

From the Microsoft example, the problem is that you're creating more than one toast notifier. Instead, you should use the same toast notifier to remove your scheduled notifications.

Upvotes: 0

Zhiming Xue
Zhiming Xue

Reputation: 352

You can remove scheduled tile notifications by using the Clear method. See detail at How to reset the TileUpdateManager from all scheduled tile notifications?

Upvotes: 1

Related Questions