【问题标题】:Silverlight: how to not load MergedDictionaries from app.xaml at startup?Silverlight:如何在启动时不从 app.xaml 加载 MergedDictionaries?
【发布时间】:2010-12-27 18:09:29
【问题描述】:

作为 Silverlight 加载资源的一种解决方法,我实现了此处发布的解决方案: Silverlight Shared MergedDictionaries

这很好用,但在 app.xaml 中注释掉资源字典很烦人。我需要注释它们才能运行应用程序,但取消注释它们可以让我获得设计视图。

我确信有办法让应用程序不加载这些,但我不是一个开发人员。有人可以指出我的教程或示例吗?一些谷歌搜索没有出现任何东西。谢谢!

【问题讨论】:

    标签: silverlight resourcedictionary app.xaml


    【解决方案1】:

    我找到了一个简单的答案:在 App() 中注释掉 InitializeComponent。

    看App.g.i.cs中的代码:

            public void InitializeComponent() {
            if (_contentLoaded) {
                return;
            }
            _contentLoaded = true;
            System.Windows.Application.LoadComponent(this, new System.Uri("/SLPortalResources;component/App.xaml", System.UriKind.Relative));
        }
    

    由于这只是加载 app.xaml 中的内容,因此将其注释掉是可行的:应用程序运行,您将获得设计视图。

    这样做有什么问题吗?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多