How to pass initialization params to a Silverlight 2 app

Last week i tried to pass some parameters to my Silverlight app when embedding it to my page. After some extended searching last week and not finding it i decided to try again today, i found it at a MS  blog:
In short:
Declare the initParams param on the Silverlight plug-in and pass in a comma-delimited set of key-value pair tokens. For e.g. “key1=value1,key2=value2,key3=value3”.
Use the function Application_Startup in App.xaml.cs to call:
string key1= e.InitParams[“key1”];
string key2= e.InitParams[“key2”];
You see, pretty easy, now pass these parameters along to the Page constructor so you can use it in the page.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.