Silverlight JavaScript Reference

7/25/2010 5:07:10 PM

Using the Silverlight Plug-in

There are two ways to access the Silverlight plug-in. Use the HTML DOM and the document.getElementById() method, and provide the ID used in the createSilverlight() function. Or intercept any Silverlight event and access the plug-in in the following fashion:

function eventHandler(sender, eventArgs) {
var plugin = sender.getHost();

From the plug-in, you have access to the following properties and methods:


Accessibility information of the Silverlight content (read-only).


The height of the Silverlight content (read-only).


The width of the Silverlight content (read-only).

content.createFromXaml(xamlContent, nameScope)

Creates a Silverlight object with the given XAML content; if nameScope is set to true, a unique x:Name attribute is assigned.

content.createFromXamlDownloader(downloader, part)

Creates a Silverlight object from the given downloader object; if the downloaded content is a ZIP archive, part defines the name of the file to use.


Returns a reference to the object with the given name.


Whether the Silverlight plug-in is in full-screen mode (read and write).


Event handler that is fired when the application enters or leaves full-screen mode.


Event handler that is fired if the Silverlight content area is resized.


Creates and returns an object with the given type.


The initialization parameters provided for the Silverlight content (read-only after the initialization).


Whether the Silverlight plug-in and its XAML content are fully loaded (read-only).


Whether the current Silverlight plug-in supports content with the given version number.


Event handler that is fired if an error occurs within the Silverlight application.


The root element of the Silverlight content (read-only).


The background color of the Silverlight content area (read and write).


Whether the current frame rate is displayed in the browser's status bar (read and write; note that not all browsers allow you to change the content of the status bar).


Whether the regions of the Silverlight content that are redrawn are highlighted (read and write; useful only during development).


Whether to allow Silverlight content to access the HTML DOM (read-only).


The maximum frame rate (number of frames) of the Silverlight content (read and write).


Whether the Silverlight application runs in windowless mode (then the background may use alphatransparency and can let the background on the HTML page shine through), set in the initialization phase (read-only afterward).


The XAML source code of the Silverlight content (read and write).

Most View
The Hub: A Solution To Online Image Theft?
What’s New In Speakers? – April 2013 (Part 1)
SQL Server 2005 : Working with SQL Server Management Objects in Visual Studio (part 1) - Iterating Through Available Servers
Windows 7 : Microsoft Deployment Toolkit 2010 - Deploying Your First Image
Windows 8 vs OS X Mountain Lion (Part 3)
Windows Server 2003 : Domain Name System - Zones Versus Domains, Resource Records
How Google Search Engine Search
Apple Mac Mini - The Hardware Is As Enticing As Ever
Dino PC Banji 3450 - Badly Built And Has Little Storage
Personalizing Windows 8 : Choosing Your Language
Top 10
Sharepoint 2013 : Farm Management - Disable a Timer Job,Start a Timer Job, Set the Schedule for a Timer Job
Sharepoint 2013 : Farm Management - Display Available Timer Jobs on the Farm, Get a Specific Timer Job, Enable a Timer Job
Sharepoint 2013 : Farm Management - Review Workflow Configuration Settings,Modify Workflow Configuration Settings
Sharepoint 2013 : Farm Management - Review SharePoint Designer Settings, Configure SharePoint Designer Settings
Sharepoint 2013 : Farm Management - Remove a Managed Path, Merge Log Files, End the Current Log File
SQL Server 2012 : Policy Based Management - Evaluating Policies
SQL Server 2012 : Defining Policies (part 3) - Creating Policies
SQL Server 2012 : Defining Policies (part 2) - Conditions
SQL Server 2012 : Defining Policies (part 1) - Management Facets
Microsoft Exchange Server 2010 : Configuring Anti-Spam and Message Filtering Options (part 4) - Preventing Internal Servers from Being Filtered