我有一個合併資源字典App.xaml
主要程序集,它包含來自單獨程序集的各種資源字典:Common和PresentationLayer。查找資源字典時發生錯誤
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Common;component/Themes/Button.xaml"/>
<ResourceDictionary Source="/PresentationLayer;component/DataTemplates/AppointmentsDataTemplates.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
在運行時,資源字典中的樣式正確應用於控件。然而,在設計時的樣式不應用和Visual Studio 2012一直給以下錯誤:
An error occurred while finding the resource dictionary "/Common;component/Themes/Button.xaml".
和警告:
The resource "BannerButton" could not be resolved.
我碰到this post但儘管設置生成操作問題仍然存在資源。另外,在Visual Studio 2010或Expression Blend 4下運行時,我沒有遇到這個問題。主程序集確實擁有對Common程序集的引用,並且我沒有更改Pack URI。
你有沒有試過使用正常的相對路徑? –
@DJ正常的相對路徑(資源字典在主程序集中)正常工作。 –
@DJ實際上,Visual Studio不再抱怨錯誤,但設計師仍然不會應用樣式。 –