Passing parameters to a Silverlight XAP application
In this post two ways to pass parameters to an in-browser Silverlight application without modifying the XAP are described:
- Using the querystring of the containing HTML/ASP.NET page
- Using the InitParams attribute of the object tag that hosts the XAP file
The first method is straight forward: just add a querystring to the URL. You can retrieve the querystring using the HtmlPage.Document like this (based on code from MSDN):
private void Application_Startup(object sender, StartupEventArgs e)
{
Page p = new Page();
this.RootVisual = p;
// This assumes that Page.LayoutRoot exists and is a StackPanel.
… Continue Reading
