Win 10 app: remove toast notification

南笙酒味 提交于 2019-12-08 04:52:31

问题


I show toast notification that it then appears on notification center.

I want then to programatically remove that notification from notification center. How can I do this? The app may be closed and restarted between time the notification is shown and when I need to remove it.


回答1:


You can programmatically remove notifications from the action center by using one of the various methods of the ToastNotificationHistory class. For example:

ToastNotificationManager.History.Remove("toast-tag");

where "toast-tag" is the Tag of the ToastNotification that you want to remove. There are other overloads too.

If you need to remove notifications at some point in time when your app isn't running, then you'll need to do so from a background task.



来源:https://stackoverflow.com/questions/39901652/win-10-app-remove-toast-notification

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!