开发者

Silverlight: Why can't silverlight see my xaml file referenced in MergedDictionary?

开发者 https://www.devze.com 2022-12-23 17:51 出处:网络
I have a silverlight application with a number of styles defined in a seperate xaml file under the directory /Styles.

I have a silverlight application with a number of styles defined in a seperate xaml file under the directory /Styles. My App.xaml looks like this:

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

Legend.xaml has its build action set开发者_开发技巧 to Content and 'Do Not Copy' as the copy to output directory setting.

The message I'm getting in blend is:

An error occurred while finding the resource dictionary "/Styles/Legend.xaml"

Thanks in advance!


Also check that the xaml is properly formed! A stray character which invalidates the xaml syntax in that Legend.xaml file, will cause it not to recognise it. Instead of telling you it's malformed, it will give you the error you describe. Hope that helps someone.


Don't ask me why but deleting the original resource dictionary and re-adding it solved the issue. Odd. Ah well


I had a similar problem, deleted the file and copied it again solved the problem. may be it's a bug in Visual Studio 2012

0

精彩评论

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