自定义SilverLight控件并调用2010-11-11 博客园 single19701.在aspx页面中切换调用同一个项目中的不同用户控件1.1.方法一修改SilverLight项目启动文件App.xml的Application_Startup事件01 private void Application_Startup(object sender, StartupEventArgs e)
02
03 {
04
05 if (!e.InitParams.ContainsKey("InitPage"))
06
07 {
08
09 this.RootVisual = new MainPage();
10
11 return;
12
13 }
14
15 switch (e.InitParams["InitPage"])
16
17 {
18
19 case "SilverlightControl1":
20
21 this.RootVisual = new SilverlightControl1();
22
23 break;
24
25 case "SilverlightControl2":
26
27 this.RootVisual = new SilverlightControl2();
28
29 break;
30
31 default:
32
33 this.RootVisual = new MainPage();
34
35 break;
36
37 }
38
39
40
41 }