Click to Rate and Give Feedback
MSDN
MSDN Library
Live Services SDK
 Invoking an Application Using a Con...

  Switch on low bandwidth view
Windows Live
Invoking an Application Using a Control

You can invoke a Silverlight application that's hosted on Silverlight Streaming using the Windows Live Silverlight Streaming control.

To make the control available to your web page, follow these steps:

  1. Modify the <html> tag to reference the devlive namespace:
    <html xmlns:devlive="http://dev.live.com">
  2. Add the following references to the page header:
    <script type="text/javascript"
    src="http://controls.services.live.com/scripts/base/v0.3/live.js">
    </script>
    <script type="text/javascript"
    src="http://controls.services.live.com/scripts/base/v0.3/controls.js">
    </script>
  3. Add the Silverlight Streaming control to your web page, as shown in the following example. Replace accountID with your account identifier, and appName with the application name:
    <devlive:slscontrol 
        silverlightVersion="1.0"
        src="/accountID/appName/" 
        installationMode="popup"
        initParams="myKey=theValue">
    </devlive:slscontrol>

The following table describes the attributes available to the Silverlight Streaming control.

Attribute Description

id

The name for this control, unique to the hosting web page.

silverlightVersion

The minimum version of the Silverlight runtime required to run your Silverlight application. If you leave this value blank, the user may be forced to download the latest Silverlight runtime in order to run your application.

src

The service name for the application, consisting of your account identifier and the application package name in the format /accountID/appName.

installationMode

Specifies how to display the prompt to install the Silverlight runtime if it is not yet installed on the client browser. Possible values are popup, inline, or none. The popup option displays a single modal pop-up prompt to install Silverlight. The inline option displays an inline medallion and install prompt wherever the Silverlight Streaming control appears (medallion is approximately 210 x 130 pixels). The none option displays no installation prompt on the page.

initParams

A user-settable string for passing initialization data to the Silverlight application when it is instantiated on the Silverlight Streaming server. Specify values as key-value pairs, enclosed in quotation marks and separated by commas (e.g., "key01=value01,key02=value02"). Values should be escaped and should not contain any spaces.

The Silverlight Streaming control defines the following events:

Event Description

onAbort

Fired when Silverlight is not installed on the browser client.

onInit

Fired before the control attributes are processed. Useful for setting the initParams attribute programmatically.

onLoad

Fired after the Silverlight frame has loaded.

onError

Fired when an error occurs during control initialization.

To use the onInit event to set the initParams attribute dynamically, set the onInit attribute to the name of a function that sets the initialization parameters, as shown in the following example:

<script type="text/javascript">
function OnInitFunction()
{
     document.getElementById('c').setAttribute("initParams", "x=1;y=" + new Date());
}
</script>
    
<devlive:slscontrol
    id="c"
    onInit="OnInitFunction";
    silverlightVersion="1.0"
    src="/32/MySilverlightApp/" 
    installationMode="popup">
</devlive:slscontrol>
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker