One more solution for this is-
use the "InitParameters" attribute of <asp:Silverlight> tag. In this attribute we will give the key value pairs . In appStartup we will put a Switch Case statement in which we can match the value of InitParameters , the value will be the name of the xmal which we want to load .... below is the code sinnept-
<div>
<asp:Silverlight ID ="silverlight1" runat="server" Height="210px" MinimumVersion="2.0" Source="~/ClientBin/SilverlightApplication1.xap"
Width="244px" InitParameters="StartPage=page"></asp:Silverlight>
</div>
<div>
<asp:Silverlight ID ="silverlight2" runat="server" Height="210px" MinimumVersion="2.0" Source="~/ClientBin/SilverlightApplication1.xap"
Width="244px" InitParameters="StartPage=NonDefaultStartPage"></asp:Silverlight>
</div>
in App.xmal.cs:
private void Application_Startup(object sender, StartupEventArgs e)
{
if (!e.InitParams.ContainsKey("StartPage"))
{
this.RootVisual = new Page();
}
else
{
switch (e.InitParams["StartPage"])
{
case "Page":
this.RootVisual = new Page();
break;
case "NonDefaultStartPage":
this.RootVisual = new Page1();
break;
default:
throw new Exception("/StartPage must be 'Page' or 'NonDefaultStartPage'.");
}
}
}
Use this code hope this will help you.