Summary
As you know, in Silverlight 2 applications, each application generates a XAP file, and only one starting user control can be set in each XAP file. If we have multiple user controls that need to be loaded in a different ASP.net page, the easiest way to do this is to set up a corresponding Silverlight project for multiple user controls, but there are many drawbacks, such as our style files that need to be copied across multiple projects.
Get ready
Now create a project structure as shown in the following illustration, we have three user controls in the Silverlight project: Contentpage, Defaultpage, MasterPage, which require different user controls to be displayed when different asp.net pages are loaded.
Ideas
This is not a difficult task to implement, we can use initparams this property, as shown in the following figure:
or specify initparameters through param in HTML:
This property is a dictionary<string,string> type, where we can set a series of key-value pair initialization parameters, separated by commas "." So our idea is simply to specify the starting user control in the asp.net page or HTML by initparameters, and then get the parameters in the Application_Startup event and set the RootVisual.