C# Silverlight 4-在页面更改(App)Application.Current时动态加载带有App.xaml的XAP。。为什么?

C# Silverlight 4-在页面更改(App)Application.Current时动态加载带有App.xaml的XAP。。为什么?,c#,silverlight,prism,mef,xap,C#,Silverlight,Prism,Mef,Xap,我决定不使用MEF/Prism方法将XAP文件加载到我正在构建的主Silverlight容器应用程序中 我有1个主Silverlight应用程序和2个将要加载的应用程序。 我的加载代码工作正常,唯一的问题是,当我在中加载XAP应用程序时,我希望在中加载App.xaml应用程序上下文,因为这是我正在播放我构建的IApplication接口的地方 public partial class AAApp : IApplication { #region IApplicatio

我决定不使用MEF/Prism方法将XAP文件加载到我正在构建的主Silverlight容器应用程序中

我有1个主Silverlight应用程序和2个将要加载的应用程序。 我的加载代码工作正常,唯一的问题是,当我在中加载XAP应用程序时,我希望在中加载App.xaml应用程序上下文,因为这是我正在播放我构建的IApplication接口的地方

 public partial class AAApp : IApplication
    {

        #region IApplication Members

        private object userContext;
        private List<Silverlight.Common.Classes.ApplicationMenuItem> menuItemsList;
        private Silverlight.Common.Controls.ApplicationMaster applicationMaster;

        public object UserContext
        {
            get
            {
                return userContext;
            }
            set{
                userContext = value;
            }
        }

        public List<Silverlight.Common.Classes.ApplicationMenuItem> MenuItemsList
        {
            get
            {
                return menuItemsList;
            }
            set
            {
                menuItemsList = value;
            }
        }

        public string ApplicationName
        {
            get { return "Application Manager"; }
        }

        public string ApplicationVersion
        {
            get { return "Version 0.1"; }
        }

        public Guid GUID
        {
            get { return new Guid("{ACD4793E-47D8-4DB7-9A32-FDB9DD6CAFD2}"); }
        }

        public bool IsFullScreen
        {
            get { return false; }
        }

        public Silverlight.Common.Controls.ApplicationMaster MasterControl
        {
            get
            {
                return applicationMaster;
            }
            set
            {
                applicationMaster = value;
            }
        }

        public bool IntialiseApp()
        {

            applicationMaster = new Silverlight.Common.Controls.ApplicationMaster();
            applicationMaster.SetApplicationContent(new MainPage());

            return true;

        }

        public bool CloseApp()
        {
            return true;
        }

        #endregion
    }

<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
             x:Class="Test.Application.ApplicationManager.AAApp"
             >
    <Application.Resources>

    </Application.Resources>
</Application>
我面临的问题是,当我将AAApp动态加载到我的主silverlight应用程序中时,我的AppApplication.Current正在更改为AAApp上下文中加载的XAP

有没有人遇到过这个问题,并且对这个问题了如指掌

我使用AppApplication.Current alot为我的应用程序等存储全局变量,随着这一变化,它正在破坏一切

谢谢