Export (0) Print
Expand All

Content Class

Silverlight

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).

System.Object
  System.Windows.Interop.Content

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

public sealed class Content

The Content type exposes the following members.

  NameDescription
Public methodSupported by Silverlight for Windows PhoneContentInfrastructure. Initializes a new instance of the Content class.
Top

  NameDescription
Public propertySupported by Silverlight for Windows PhoneActualHeightGets the browser-determined height of the Silverlight plug-in content area.
Public propertySupported by Silverlight for Windows PhoneActualWidthGets the browser-determined width of the Silverlight plug-in content area.
Public propertyFullScreenOptionsGets or sets a value that indicates the behavior of full-screen mode.
Public propertyIsFullScreenGets or sets a value that indicates whether the Silverlight plug-in is displaying in full-screen mode.
Public propertyZoomFactorGets the factor by which the current browser window resizes its contents.
Top

  NameDescription
Public methodSupported by Silverlight for Windows PhoneEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public eventFullScreenChangedOccurs when the hosted Silverlight plug-in either enters or exits full-screen mode.
Public eventSupported by Silverlight for Windows PhoneResizedOccurs when the ActualHeight or the ActualWidth of the Silverlight plug-in change.
Public eventZoomedOccurs when the zoom setting in the host browser window changes or is initialized.
Top

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 });
}


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2015 Microsoft