Partager via


NotificationWindow.Content Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets the root of visual elements that define the visual look of the notification.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public Property Content As FrameworkElement
public FrameworkElement Content { get; set; }

Property Value

Type: System.Windows.FrameworkElement
A single FrameworkElement that includes the root of a visual tree. The visual tree defines the visual look of the notification.

Remarks

The object that is used for the Content root is typically a UserControl. Because the appearance and behavior of a notification window is controlled largely by how it is shown in context, styling and templating the content for Content is not necessary and a UserControl is therefore adequate.

Content within a notification cannot receive keyboard focus or process keyboard events. Content within a notification can receive mouse or stylus input, and can process mouse events. However, 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.

An action that is permitted from the context of a notification window event handler from NotificationWindow.Content is to call Application.MainWindow.Activate() against Application.Current. This forces the focus back to the main application window of the out-of-browser application that initiated that notification.

Version Information

Silverlight

Supported in: 5, 4

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.