Export (0) Print
Expand All

ActualHeight Property (Silverlight Plug-in)

Gets the height of the rendering area of the Silverlight plug-in.

Scripting (Instantiation) Not directly set during instantiation, but influenced by instantiation height value
Scripting (Runtime)
value = silverlightObject.content.ActualHeight

Property Value

integer

The height of the rendering area of the Silverlight plug-in in pixels.

This property is read-only. The default value is the height of the Silverlight plug-in, as specified by the OBJECT/EMBED tag that instantiated it. For more information on how this property is set during initialization, see Instantiating a Silverlight Plug-in (Using CreateSilverlight.js and Silverlight.js).

Remarks

This property is available on the content sub-object of a Silverlight plug-in instance.

Important   In the early stages of the object lifetime of a Silverlight plug-in instance, ActualHeight and ActualWidth do not contain a usable value. The OnLoad event does not yet guarantee a correct value for ActualHeight or ActualWidth. In general, you should check these values in the handler for the OnResize event, which occurs just thereafter.

A Silverlight plug-in can display in either embedded mode or full-screen mode:

  • embedded mode: plug-in displays within the Web browser.
  • full-screen mode: plug-in displays on top of all other applications.

When the Silverlight plug-in is in embedded mode, the value of ActualHeight depends on whether the height of the Silverlight plug-in is a fixed-width or percentage value. The height of the Silverlight plug-in is defined in the OBJECT tag of the containing Web page. If the height of the Silverlight plug-in is a fixed-width value, such as "300", ActualHeight is set to the plug-in height. If the height of the Silverlight plug-in is a percentage value, such as "100%", ActualHeight is set to the most appropriate height for displaying the plug-in in a browser. In this case, resizing the browser window height causes the ActualHeight value to change.

When the application is in full-screen mode, the value of ActualHeight is set to the current vertical resolution of the display.

The OnResize event occurs whenever the ActualHeight and ActualWidth properties change, and the Silverlight plug-in is in embedded mode. When the Silverlight plug-in is in full-screen mode, the OnResize event does not occur.

Examples

The following JavaScript example shows how to use the ActualWidth and ActualHeight properties. In the case where height is defined as a percentage value, the ActualHeight value represents a height value in pixels:

JavaScript
function onResizeStatus(sender, eventArgs)
{
    // Concatenate the size values as a formatted message string.
    var msgString  = " actualWidth: " + slPlugin.content.actualWidth;
        msgString += " actualHeight: " + slPlugin.content.actualHeight;

    // Display an alert dialog box with a formatted message string.
    var textBlock = sender.findName("Status");
    textBlock.text = msgString;
}

Applies To

Silverlight Plug-in

See Also

Instantiating a Silverlight Plug-in (Using CreateSilverlight.js and Silverlight.js)
Resizing a Silverlight Plug-in
Silverlight Full-screen Support
ActualWidth
OnResize

Community Additions

Show:
© 2015 Microsoft