Action Center Notifications In Universal Windows Programs: Part 2

Before reading this article, I highly recommend reading the previous part of the series:

In this article I will explain about how to handle the events in the Action center.

Notification display in the Action center window, if user clicked or dismissed the notification, corresponding application receives the event from action center, based on that we can manage our application functionality.

Before displaying the Notification in Action center, first implement the event activated & dismissed event

Notification in Action center

Notification

Activate: If user clicked notification, event raised.

Dismissed: Is user cancelled or time out of the Notification, this event will raise.

Note:

Handling any UI functionality inside this event, crossed thread issue raised, so the UI functionality code moved to the core window thread.

Issue

Issue

Solution: Handle UI updates with Dispatcher thread

Handle UI updates

Toast Notification.Tag

This Tag property used to show the updated (new notification message) into the action center, previous notification message automatically deleted and new message displayed.

In this article, button click, update the Notification, last button click notification display in the Action center, old notification automatically removed.

Sample code

Sample code

Each button count increased and display into the Action center

Each button count increased

Each button click, action center is updated.

action center is updated

suppressPopup

This property is used to silently add message to the action center, there is no popup message to the user.

Default is false & popup message display.

suppressPopup

Group

Group property is used to group all the notifications into single package (Internally treat as single item)

Group

Example: Where can we use this

Requirement: Suppose multiple notifications items display into the Action center, if we remove one item, it automatically remove other items also.

Solution:

Create toast notification with group name &implement dismissed event.

Dismiss event, read the group name and remove the item in Action center.

Code

Action center

Remove any one of the items (ex: Toast Msg: 5), so the remaining items remove automatically.

Up Next
    Ebook Download
    View all
    Learn
    View all