1
这可能是一个非常愚蠢的问题,但我现在根本无法理解问题。从代码创建应用程序并从xaml加载资源词典
我有一个定义的应用程序级资源的App.xaml文件:
<Application x:Class="WpfMPManager.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="MyDictionnary.xaml"/>
</ResourceDictionary>
</Application.Resources>
由于种种原因,我开始通过这个的.cs应用程序文件类似的(其实有很多更继续在这个文件中)。
[STAThread]
static void Main(params string[] args)
{
App myApp = new App();
MainWindow myWindow = new MainWindow();
myApp.Run(myWindow);
}
然而,当我以这种方式启动的应用程序,我的应用程序资源dictionnaries是空的(如果我开始通过我的app.xml中应用他们确实填写)。
我应该在Application对象上调用一个特定的方法来强制它加载在.xaml文件中定义的资源字典吗?
在此先感谢。