Content Class
Reports details about the instantiation settings of a-based application, and exposes some of the HTML DOM values for the hosted Silverlight plug-in instance. The Content object contains APIs that specifically relate to the Silverlight content area (the area that is declared by the width and height in the initialization).
Namespace: System.Windows.Interop
Assembly: System.Windows (in System.Windows.dll)
The Content type exposes the following members.
| Name | Description | |
|---|---|---|
![]() ![]() | ActualHeight | Gets the browser-determined height of the Silverlight plug-in content area. |
![]() ![]() | ActualWidth | Gets the browser-determined width of the Silverlight plug-in content area. |
![]() | FullScreenOptions | Gets or sets a value that indicates the behavior of full-screen mode. |
![]() | IsFullScreen | Gets or sets a value that indicates whether the Silverlight plug-in is displaying in full-screen mode. |
![]() | ZoomFactor | Gets the factor by which the current browser window resizes its contents. |
| Name | Description | |
|---|---|---|
![]() ![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() ![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
![]() ![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() ![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() ![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() ![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
| Name | Description | |
|---|---|---|
![]() | FullScreenChanged | Occurs when the hosted Silverlight plug-in either enters or exits full-screen mode. |
![]() ![]() | Resized | Occurs when the ActualHeight or the ActualWidth of the Silverlight plug-in change. |
![]() | Zoomed | Occurs when the zoom setting in the host browser window changes or is initialized. |
This object is always the value of the Content property of a parent SilverlightHost, and this is the only context in which a Content object is used.
The following code example demonstrates how to use this class in a variety of ways.
Page rootPage = new Page(); private void Application_Startup(object sender, StartupEventArgs e) { this.RootVisual = rootPage; rootPage.LayoutRoot.MouseLeftButtonDown += delegate(Object s, MouseButtonEventArgs args) { this.Host.Content.IsFullScreen = !this.Host.Content.IsFullScreen; }; this.Host.Content.FullScreenChanged += new EventHandler(DisplaySizeInformation); this.Host.Content.Resized += new EventHandler(DisplaySizeInformation); } private void DisplaySizeInformation(Object sender, EventArgs e) { String message = String.Format( "ActualWidth={0}, ActualHeight={1}", this.Host.Content.ActualWidth, this.Host.Content.ActualHeight); rootPage.LayoutRoot.Children.Clear(); rootPage.LayoutRoot.Children.Add( new TextBlock { Text = message }); }
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.




