简体   繁体   English

ASPX页面中的Silverlight控件

[英]Silverlight control in aspx page

i have two silverlight user controls name region.xaml and session.xaml and i want to place them in region.aspx and session.aspx respectively. 我有两个Silverlight用户控件,名称分别为region.xaml和session.xaml,我想将它们分别放置在region.aspx和session.aspx中。 The problem is that in both the aspx pages i am getting the region.xaml control how to fix it hta in the session.aspx session.xaml control will be displayed. 问题是,在两个aspx页面中,我都获得了region.xaml控件,如何在session.aspx session.xaml控件中修复它。

I have found the solution: 我找到了解决方案:

first we need to set the properties in 首先,我们需要在

and then need to ammed the App.xaml file of silverlight application as shown below: 然后需要修改Silverlight应用程序的App.xaml文件,如下所示:

    private void Application_Startup(object sender, StartupEventArgs e)
    {
        string ControlID = "ControlID";
        if (e.InitParams.ContainsKey(ControlID))
        {
            switch (e.InitParams[ControlID])
            {
                case "RegionControl":
                    this.RootVisual = new RegionControl();
                    break;

                case "SessionControl":
                    this.RootVisual = new SessionControl();
                    break;

                default:
                    break;
            }
        }
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM