Partager via


EnableFramerateCounter

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

Gets or sets a value that indicates whether to display the current frame rate in the hosting browser's status bar. (Microsoft Internet Explorer only.)

value = silverlightObject.settings.enableFrameRateCounter
silverlightObject.settings.enableFrameRateCounter = value

Property Value

Type: Boolean

true if the frames-per-second (fps) of the current rendered Silverlight content will be displayed in the hosting browser's status bar; otherwise, false.

This property is read/write. The default is false.

Managed Equivalent

EnableFrameRateCounter

Remarks

The EnableFrameRateCounter property is useful as a diagnostic while you are optimizing your application code by showing the frames-per-second (fps) of the current rendered Silverlight content. You can use the frame rate information to identify performance bottlenecks in your application.

You can set this property only at run time after the Silverlight plug-in has loaded. This property is available on the settings subobject of a Silverlight plug-in instance. This property does not have a matching parameter on CreateObject/CreateObjectEx in the silverlight.js file. You can set it, for example, in an OnLoad handler. If you set this property to false after you set it to true, the counter will still appear, but will no longer be updated. You should set this property only while debugging, and remove it from production code.

The frame rate counter feature enabled by this property is supported on Microsoft Internet Explorer running on Windows XP SP2 or greater. Support on other browsers is not guaranteed.

The format of the frame rate counter is as follows:

fps:currentFramerate/maxFramerate

currentFramerate is the optimal frame rate that would apply in the absence of an upper frame rate limit, based on conditions in the plug-in's environment and as reported by the plug-in. maxFramerate is configurable through the framerate initialization parameter. maxFramerate defaults to 60. Each number is a value that reports frames per second (fps). Whichever number is lower is the actual displayed frame rate. You can illustrate the relationship between currentFramerate and maxFramerate by setting a deliberately low frame rate, such as 2 per second, and observing the results.

NoteNote:

Internet Explorer has a security setting that may prevent Silverlight (and other applications) from scripting to the status bar, and in this case you cannot see a framerate counter even when EnableFrameRateCounter is true. To rectify this situation, you must adjust the security settings of Internet Explorer for the pertinent zone. In the Internet Explorer menu, open Tools / Options / Security. Select Internet zone and Custom level. Enable Allow status bar updates via script.

Example

The following JavaScript example shows how to retrieve the value of the EnableFrameRateCounter property.

// Retrieve a reference to the plug-in.
var plugin = sender.getHost();

// Retrieve the EnableFrameRateCounter property.
var enableFramerateCounter = plugin.settings.enableFrameRateCounter;

Applies To

Silverlight Plug-in

See Also

Reference