Search code examples
wpfexpression-blendstyles

Why is Expression Blend 4 not finding resources that are in a global Resource Library


For some reason with this WPF project, I am getting the following exception in Blend:

enter image description here

This happens when one UserControl is inside another UserControl or Window. ItemBorder is a style that exists in a Resource Library linked to the application XAML file. It doesn't matter where I move this resource or its library. Even if I put it directly into the UserControl that is using it, I get this exception. Only when I make it a local value and not a resource does this exception go away. This exception only happens in Blend. It doesn't happen in Visual Studio (i'm using 2010), and it doesn't occur when I run the application.

I'm at the end of my rope here. This problem means I am completely unable to use Expression Blend.


Solution

  • Tried making it a dynamic resource?

    I am not especially clear on the rules in play that determine Static vs Dynamic even give the answer below, but It has resolved a lot of issues for me when loading resources to change it from a Static to Dynamicresource.

    What's the difference between StaticResource and DynamicResource in WPF?

    Alright, after a little digging, I found this. The OP in this post has a situation quite similar to yours. His work around suggests merging resource dictionaries at the Usercontrol level rather than only through App.xaml.