How to Create Silverlight Apps With JavaScript

How to Create Silverlight Apps With JavaScript thumbnail
Developing Silverlight applications with JavaScript is fun.

Silverlight server-web applications can execute on client machines, communicate with servers and services over the Internet and are regarded as safe and secure. A Silverlight application consists of four files which include a Silverlight.js file, a Hyper Text Markup Language (HTML) hosting file, an Extensible Application Markup Language (XAML) file and a JavaScript file that supports the HTML file.

Instructions

  1. Silverlight.js File

    • 1

      Navigate to the Silverlight SDK location on your local drive and locate the Silverlight.js file. The default location is:

      C:\Program Files\Microsoft Silverlight (Ver) SDK\Tools\Silverlight.js

    • 2

      Copy this file into a folder where you will also include all your other files necessary to create your Silverlight application.

    • 3

      Create a new text document in this folder and give it an appropriate name. Add the file extension ".htm."

    • 4

      Reference the Silverlight.js file by writing the code below inside the HTML file "head" tags:

      <head>

      <title>Silverlight App</title>

      <script type= "text/javascript" src= "Silverlight.js">

      </script>

      <script type= "text/javascript" src= "CreateSilverlight.js">

      </script>

      </head>

      The above code references the "Silverlight.js" file that we copied. The "CreateSilverlight.js" is created separately.

    CreateSilverlight.js File

    • 5

      Create a new text document in the same folder and rename it "CreateSilverlight.js."

    • 6

      Copy and paste the JavaScript code below inside the "CreateSilverlight.js" file:

      Function createMySilverlightControl()

      Var parentElement = document.getElementById( "mySilverlightControlHost");

      Silverlight.createObject(

      "SilverlightApp.xaml",

      parentElement,

      "mySilverlightControl",

      {

      Width: '300',B00011';

      isWindowless: 'false',

      framerate: '24',

      version: 2.0',

      Heigh: '300',

      inplaceInstallPrompt:true,

      background: '#B00001',

      {

      onError: null,

      onLoad:null

      },

      Null);

      }

      There is a reference to "SilverlightApp.xaml." Ensure that this file resides in the same folder as all the files.

    • 7

      Test the Silverlight application by double-clicking on the HTML file you created in the folder. Allow blocked content when prompted and view your application. If the application is working, contents of the "SilverlightApp.xaml" file will be displayed.

Tips & Warnings

  • When using the Silverlight Streaming service offered by Microsoft, update the "src" tag inside your HTML file from "Silverlight.js" to "http://agappdom.net/h/silverlight.js."

  • The script tag should read as follows:

  • <script type= "text/javascript" src= http://agappdom.net/h/silverlight.js></script>

  • Package all the files in a compressed file and include a "manifest.xml" file that contains extra parameters.

  • If you want to capture the URL of a hosted application on Silverlight Streaming Service, log in to your Silverlight Streaming account and manage your applications (see Resources).

  • Do not attempt to display a Silverlight application on a public website if it contains confidential information. Silverlight applications on a hosted service are not secure.

Related Searches:

References

Resources

  • Photo Credit businessman and laptop isolated image by Alexey Klementiev from Fotolia.com

Comments

You May Also Like

  • How to Create a Silverlight Presentation

    Silverlight is an application platform for developing rich media applications, similar to that of Adobe Flash. It is a free plug-in framework...

  • Pro Tools Control 24 Desk Tips

    The Pro Tools Control 24 desk is a recording sound board that acts as a manual remote control for a Pro Tools...

  • How to Change the Size of Silverlight Applications

    Microsoft Silverlight is an application platform utilized for creating rich applications with a focus on animations, multimedia and graphics. A run-time version...

  • How to Disable Silverlight Popups

    According to the Microsoft website, "Silverlight is a powerful development platform for creating engaging, interactive applications for the Web, desktop and mobile...

  • How to Embed Silverlight in HTML

    Silverlight is a new development platform from Microsoft for creating rich media applications for the Web and desktop and mobile operating systems....

  • How to Host a Wpf Application in Silverlight

    Silverlight is a Microsoft coding system used to create web-hosted applications, frequently videos or interactive games. You can now make offline applications...

  • How to Add an Image to a Silverlight Button

    Open the Silverlight editor and double click the form you want to edit in the "Solution Explorer" workspace. Scroll down to the...

  • Silverlight Freeware Alternatives

    Silverlight Freeware Alternatives. Microsoft Silverlight is a multi-browser plug-in which is designed to provide a media experience with Rich Interactive Applications ...

  • How to Set Values in Silverlight

    Knowing how to set values to Silverlight objects can save you time when developing Silverlight applications. Silverlight is a Microsoft product used...

Related Ads

Featured