You can have one Silverlight application project (one xap file).  Assume it contains two UserControls Page1.xaml and Page2.xaml, and you want Page1 to be shown in Silverlight Control1, and Page2 to be shown in Silverlight Control2 in the same aspx page.

You can use initParams in the Silverlight control tag to indicate which UserControl you want to use as the application start up page:

Code in App.xaml Application_Startup:

private void Application_Startup(object sender, StartupEventArgs e)
{

if(e.InitParams.ContainsKey[“Page”])

{

string page = e.InitParams[“Page”];

if(page == “Page1”)

this.RootVisual = new Page1();

if(page == “Page2”)

this.RootVisual = new Page2();

}

}

Advertisements