【发布时间】:2014-07-02 09:02:31
【问题描述】:
这是我的解决方案资源管理器:
我想做这个:
ResourceDictionary dictionary = new ResourceDictionary();
dictionary.Source = new Uri("../Themes/Generic.xaml", UriKind.RelativeOrAbsolute);
Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary());
在PageWithoutMaster的构造函数中。
我得到错误:找不到资源'themes/style/master.xaml'
我做错了什么?为什么要在路径中添加style文件夹?
【问题讨论】:
-
您是否尝试过使用绝对 URI:
pack://application:,,,/projectname;component/Themes/Generic.xaml? -
dictionary.Source= new Uri("Themes/Generic.xaml", UriKind.Relative);
-
@HeenaPatil 同样的错误。
-
@dkozi 它不起作用:(
-
我猜你将 master.xaml 合并到 Generic.xaml 中。您是否尝试以与
/assemblyname;component/Style/master.xaml相同的方式将路径设置为 master.xaml,在其中引用它?