开发者

Silverlight ResourceDictionary not available

开发者 https://www.devze.com 2023-02-20 12:21 出处:网络
I\'ve put a few good hours into this.. I\'m 开发者_如何学JAVAunable to see the various styles I have defined in a global Resource dictionary.The external file is called Styles.xaml.What am I missing?

I've put a few good hours into this.. I'm 开发者_如何学JAVAunable to see the various styles I have defined in a global Resource dictionary. The external file is called Styles.xaml. What am I missing?

Silverlight ResourceDictionary not available


There are a few things to consider using MergedDictionaries.

First you should set the BuildAction of the ResourceDictionary (Styles.xaml) to Resource or Content (I tried it with Resource).

Second in your App.xaml do not define a Key for the ResourceDictionary (remove x:Key="ButtonStyles")

Then put all other resources in your Application.Resources in the ResourceDictionary.

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="/Assets/Styles.xaml"/>
        </ResourceDictionary.MergedDictionaries>

        <CCE_2009_Client_ViewModels:ViewModelLocator x:Key=ViewModelLocatorDataSource/>

        <!-- Any additional resources -->
    </ResourceDictionary>
</Application.Resources>

After all this is done then you should select the Style in the Properties Window.


Do you have referenced CCE_2009.Client assembly (project) in the project you want to use this style?

If not this can be a fix for your problem.

0

精彩评论

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