A notification is a UI area that is displayed for a period of time and then closes automatically even if no user interaction occurs. Systems that implement notifications typically have them display in a fixed, particular area of the UI. An alternative colloquial term for notifications that is used by some programmers is toast.
Notifications are exclusively for use in an out-of-browser application scenario for Silverlight 4. The out-of-browser installation or startup experience indicate to a user that an application is now running in the context of the local client computer, rather than as a Web site with Silverlight content. For more information about out-of-browser installation or startup, see Out-of-Browser Support.
Similar to Popup, content of a notification window is not part of the primary Silverlight visual tree, it effectively is described by a separate visual tree that is rendered and added to the content area. For purposes of XAML namescope resolution, a notification window's objects exists in a separate XAML namescope.
Using Popup within a notification window is not supported.
You must set Height and Width on a notification window before Show is called and the notification displays. Attempting to set the height/width of a displayed notification throws an exception. You may want to check Visibility first to avoid the exception.
User Interaction with a Notification Window
Content within a notification cannot receive keyboard focus or process keyboard events. Conceptually, the content of a notification should be thought of as read-only. Typically, the user sees the notification but knows that it will eventually time out without requiring input.
Content within a notification can receive mouse or stylus input, and can process mouse events. You can handle these input events to bring the main application window into focus, by calling Window..::.Activate. This is for a scenario where the user has switched to another application and the application that owns the notification is not the topmost window.
The input events from a notification window are not considered to be user-initiated for purpose of certain Silverlight features that require explicit user initiation. Examples of features that require user initiation and thus cannot be invoked from notification window UI include: navigating from a HyperlinkButton; displaying SaveFileDialog or OpenFileDialog; accessing the system clipboard; changing to full-screen mode. Calling Window..::.Activate is essentially the only privileged action that can be initiated from an input event handler for notification window content.
Notification Positioning and Dimensions
When Show is called, the notification is positioned so that the lower-right corner of the notification content area is (-44,-44) pixels offset from the lower right of the workspace dimensions of the primary monitor. The Height and Width add to the window dimensions in the up and left directions, respectively, starting from the lower-right positioning point.
Multiple Notifications
NotificationWindow API does not directly support queue or render logic for multiple notifications. If your application calls Show again on a second notification window instance while the previous notification is still displayed, an exception is thrown from Show. You can potentially design your own queue logic so that you can handle multiple notifications by staggering the notifications. Or you could display a dedicated notification that states that multiple notifications want to display and then use an alternative UI for the multiple-notification case.
Although only one notification window is permitted per application, it is possible that multiple Silverlight out-of-browser applications are running simultaneously, and each shows a notification window. In this case, the notifications appear in the same place but can overlap, with the most recently shown notification on top.