共用方式為


ActualHeight (Silverlight Plug-in Object)

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

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

Syntax

object Element

Not applicable. This property is not settable on instantiation. However, the height property of the object element is settable and affects the ActualHeight value.

Silverlight.js

Not applicable. This property is not settable on instantiation. However, the height parameter of CreateObject and CreateObjectEx functions is settable and affects the ActualHeight value.

JavaScript

value = silverlightObject.content.ActualHeight;

COM

IXcpControl::Content gets an IDispatch interface, which you can use to call ActualHeight.

Managed Code

Property Value

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

This property is read-only for all means of access. The default value is the height property value of the Silverlight plug-in, as specified by the object element that instantiated it.

Remarks

Important noteImportant Note:

In the early stages of the object lifetime of a Silverlight plug-in, ActualHeight and ActualWidth do not contain usable values. In particular, when the DOM Loaded event occurs, correct values for ActualHeight and ActualWidth are not guaranteed. In general, you should check these values in the handler for the Resized event, which occurs just after the DOM Loaded event when a Silverlight plug-in is first instantiated on an HTML page. If Resized occurs again, it indicates that ActualHeight or ActualWidth have changed at run time, and any saved values should be adjusted.

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

  • In embeddedmode, the plug-in is displayed in the Web browser content area.

  • In full-screen mode, the plug-in is displayed 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 pixel count or a percentage value. The height of the Silverlight plug-in is defined in the object element of the containing HTML page. (The actual object element and its height might be specified indirectly, through Silverlight.js helper functions.) If the height is a pixel-count 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, if the browser window height is changed (either through a user action or by manipulating the HTML DOM), the ActualHeight value changes also.

When the application is in full-screen mode, the value of ActualHeight is set to the current vertical resolution of the user's display. For more information, see Full-Screen Support.

When the Silverlight plug-in is in embedded mode, the Resized event occurs whenever the calculated values of the ActualHeight and ActualWidth properties change. When the Silverlight plug-in is in full-screen mode, the Resized event does not occur. If the mode changes from embedded to full-screen, or full-screen to embedded, the Resized event does not occur. Instead, the FullScreenChanged event occurs.