Page view counter

Did You Know... There are two ways to pass data to your Silverlight 1.0 control on creation

CreateSilverlight() and its wrapper, CreateSilverlightEx() both take an optional sixth and seventh parameter. The sixth, initParam takes a string parameter that you can easily fetch in your javascript code; it becomes an attribute of the Silverlight control (plugin) itself.

For example, you can modify the starter sample that Visual Studio 2008 creates for you by adding this line to Default.html.js:

 

parametersix 

The sixth parameter must be a string. How you use that string is entirely up to you.  . To see using this parameter at work, modify HandleMouseUp in  Scene.xaml.js as follows:

handleMouseUp: function(sender, eventArgs) 
{
    var mouseUpAnimation = sender.findName("mouseUp");
    mouseUpAnimation.begin(); 
var paramValue = this.plugIn.initParams; alert(paramValue); }

In this case, you're accessing the value of the parameter passed in by the user, and placing it into the alert box when the button is clicked.

passingcontent

 
 
Published 17 December 2007 05:02 PM by jesseliberty

Comments

# Community Blogs said on 24 December, 2007 10:42 PM

Merry Christmas from SilverlightCream -- Here's a whole bunch of things that found it's way into