What is Silverlight.js file? Explain with an example

Answer

Silverlight.js file is a Java Script helper file. It supports for adding a Silverlight application to a web page through Java Script. It has a number of methods defined to help with, most importantly the createObject and createObjectEx. The following are certain notable functions and event handlers :

-getSilverlight, isBrowserRestartRequired, isInstalled, onGetSilverlight, onSilverlightInstalled, WaitForInstallCompletion.

The Silverlight.js file is installed along with Silverlight 2 SDK.

Using Visual Studio 2008, one can create a quick sample project by selecting File->New Project and selecting Silverlight Application. After clicking OK, select “Automatically generate a test page to host Silverlight at build time”. Click on OK. Right click on the new project and add an HTML page.

Copy the Silverlight.js into local project directory. Define a reference to Silverlight.js like any other Java Script file:

<script type="text/javascript" src="Silverlight.js"></script>
Select createObject or createObjectEx, for creating Silverlight object. Add the following for creating createObjectEx:

// createObjectEx, takes a single parameter of all createObject parameters enclosed in {}

Silverlight.createObjectEx = function(params)
{
      var parameters = params;
      var html = Silverlight.createObject(parameters.source, parameters.parentElement, parameters.id,   parameters.properties, parameters.events, parameters.initParams, parameters.context);
     if (parameters.parentElement == null)
     {
           return html;
     }

All silverlight Questions

Ask your interview questions on silverlight

Write Your comment or Questions if you want the answers on silverlight from silverlight Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---