WPF 4:合并词典don';我好像不再工作了
我有下面的XAML块WPF 4:合并词典don';我好像不再工作了,wpf,styles,resourcedictionary,Wpf,Styles,Resourcedictionary,我有下面的XAML块 'BaseStyles.xaml <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ResourceDictionary.MergedDictionaries> <Resourc
'BaseStyles.xaml
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ShinyBlue.xaml"/>
<ResourceDictionary Source="DataGrid.Generic.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
”BaseStyles.xaml
表单在设计时引用此工作,但在运行时不引用。
如果我的表单直接引用ShinyBlue.xaml或DataGrid.Generic.xaml,则该样式表有效
编辑
如果我将其直接粘贴到表单中,它将正常工作。显然,这个问题与我的包装纸有关
破碎的
<Window.Resources>
<ResourceDictionary Source="../BaseStyles.xaml"/>
</Window.Resources>
工作
尝试包含从名称空间到文件名的整个路径:
<ResourceDictionary Source="pack://application:,,,/[YourDll];component/[YourLocation]/ShinyBlue.xaml"/>
其中,[YourDll]是项目的名称,[YourLocation]是ResourceDictionary驻留在dll中的位置。在WPF 4中,它似乎对我很好。。。您能否提供项目的精简版本?
<ResourceDictionary Source="pack://application:,,,/[YourDll];component/[YourLocation]/ShinyBlue.xaml"/>