我有下面的XAML块
'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>窗体在设计时引用此工作,但在运行时不引用此工作。如果我的表单直接引用ShinyBlue.xaml或DataGrid.Generic.xaml,则该样式表可以工作。
编辑
如果我将它直接粘贴到表单中,它就会正常工作。从表面上看,这个问题与我的包装有关。
坏的
<Window.Resources>
<ResourceDictionary Source="../BaseStyles.xaml"/>
</Window.Resources>作品
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ShinyBlue.xaml"/>
<ResourceDictionary Source="DataGrid.Generic.xaml"/>
</ResourceDictionary.MergedDictionaries>发布于 2010-04-28 07:57:43
尝试包含从命名空间到文件名的整个路径:
<ResourceDictionary Source="pack://application:,,,/[YourDll];component/[YourLocation]/ShinyBlue.xaml"/>其中YourDll是项目的名称,YourLocation是ResourceDictionary驻留在dll中的位置。
https://stackoverflow.com/questions/2670473
复制相似问题