NotificationWindow – Silverlight 4

Posted by Corey on November 18, 2009 at 7:51 pm.

A new addition to Silverlight 4 is the NotificationWindow.  This type of window enables you to show a System notification much like when you receive an Outlook new mail notification or a Growl notification in OSX. Since it operates like a system message, this feature is only available in Out of Browser (OOB) scenarios.

This example shows how to instantiate a NotificationWindow, with the resulting application like the below screenshot.

image 

Code

And now for the code. The items to note:

  • In the Tick event check to see if the application is running in OOB.
  • If yes, then instantiate a NotificationWindow object.
  • Set the Content (this could be as simple as a TextBlock or a custom UserControl)
  • To show the Notification, call the Show method specifying, in milliseconds, the duration of the Notification.

image

 

image

Q: Can I show multiple notifications?
A: No, there isn’t a queue.

Q: Can the user interact with the NotificationWindow?
A: Yes, but only mouse support.

Q: What is the size of the NotificationWindow?
A: 400×100 (btw, I love Pixus)

image

 

Q: Can the NotificationWindow be customized?

A: Yes, below is a screenshot of the notification window using a custom UserControl instead of a TextBlock like the above example.

image

5 Responses to “NotificationWindow – Silverlight 4”

Leave a Reply