Partager via


ActualHeight (Silverlight Plug-in)

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

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

value = silverlightObject.content.ActualHeight

Property Value

Type: 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.

Managed Equivalent

ActualHeight

Remarks

See also ActualHeight (Silverlight Plug-in Object). ActualHeight is the JavaScript / DOM exposure of a common value of the plug-in object, which can be accessed by a number of programming models, including managed code and COM.

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

Important noteImportant Note:

In the early stages of the object lifetime of a Silverlight plug-in instance, ActualHeight and ActualWidth do not contain usable values. In particular, 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 after OnLoad.

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

  • In embeddedmode, the plug-in displays in the Web browser window.

  • In full-screen mode, the 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.

Example

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.

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