开发者

ResourceDictionary with MVVM and Prism

I have set up a Prism project with one module. In the module I have defined some views. I want to use a ResourceDictionary to style UI elements.

However...if I include the following code in the View1.xaml i get the following error

Warning 1 The designer does not support loading dictionaries that mix 'ResourceDictionary' items without a key and other items in the same collection. Please ensure that the 'Resources' property does not contain 'ResourceDictionary' items without a key, or that the 'ResourceDictionary' item is the only element in the collection.

Here is the code:

<UserControl.Resources>                
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="../Resources/ResourceDictionary.xaml"/>
     开发者_如何学Python   </ResourceDictionary.MergedDictionaries>        
    </ResourceDictionary>
</UserControl.Resources>

If I include the code in the App.xaml file the style looks applied in the designer, but when I run the project i get the following error:

Cannot find a Resource with the Name/Key

Do you have any useful advices how to use ResourceDictionary styles with Prism and MVVM?

Thanks


Maybe this guy here had a similar problem: http://blog.caraulean.com/2011/09/13/how-to-make-caliburn-micro-and-silverlight-resources-in-mergeddictionaries-play-nicely-together/ Have a check

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜