Silverlight: Why can't silverlight see my xaml file referenced in MergedDictionary?
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
精彩评论