Partager via


EnableFramerateCounter (Silverlight Plug-in Object)

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

Syntax

object Element

Not applicable. This property is not settable on instantiation.

Silverlight.js

Not applicable. This property is not settable on instantiation.

JavaScript

silverlightObject.settings.EnableFramerateCounter = bool;
value = silverlightObject.settings.EnableFramerateCounter;

COM

IXcpControl::Settings get an IDispatch interface, which you can use to call EnableFramerateCounter.

Managed Code

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.

This property cannot be set in an initial object element. You can set it at run time after the object is instantiated. For example, you can set it in the OnLoad handler that is attached to the Silverlight plug-in. 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/maxFrame

currentFramerate is the optimal frame rate that would apply if there is no upper frame rate limit, based on conditions in the plug-in environment and as reported by the plug-in. The maxFramerate value is configurable through the maxframerate parameter of the Silverlight plug-in object. The maxframerate parameter defaults to 60. currentFramerate and maxFramerate are values that report 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 maxframerate value, such as 2 (2 frames per second), and observing the results.

If EnableGPUAcceleration is true AND EnableFrameRateCounter is true, an additional frame counter displays in the upper-left corner as an overlay within the Silverlight content area. The format of this frame rate counter is as follows:

frameRate videoMemoryUsed GPUEnabledSurfaces intermediateSurfaces

videoMemoryUsed is in KB. intermediateSurfaces refers to surfaces implicitly created to represent the software-rendered parts of the application on the GPU.

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. This consideration does not affect the additional framerate counter displayed if EnableGPUAcceleration is also true.