Blend, WPF and resource references

A number of people have sought more clarity around how Blend and resources references work inside WPF projects. Hope the following FAQs would help with some of your questions.

a) Should I use Static or Dynamic resource lookup?
Blend def. plays better with dynamic resource lookups. You could use a static resource lookup as long as the resource was not located or merged into App.xaml. People have raised concerns around performance issues with dynamic resource lookups (you pay for what you get). While that might be true, an interesting data point is that the Expression Blend source code uses a ton uses dynamic resource lookups for our own UI (of course, we too use static resource lookups in places where the resource would never change, or where it not possible to use a dynamic resource extension, for example non-DPs).

b) If I had to used a static resource lookup, why don't things work when the resource is located in App.xaml?
When a static resource lookup is done inside the Blend design surface, unfortunately, the resource ends up being looked inside the Application object of Blend (which is in itself a WPF application). This does not play well with the way we host the design surface - we don't want to merge the user resources into the Blend Application object to avoid conflicts with the Blend UI styles. Please be assured that solving this problem is pretty high our wish list (and we are working with the WPF team on a solution).

P.S.: If you do run into this issue, the most common symptom is that an exception is thrown on the design surface when you try to instantiate your control which reads something like - XamlParseException - Cannot find resource named '{Blah}'. Resource names are case sensitive...."

c) How can I create a control library of resources and use those resources in a different project?
Here is an example solution that shows you the setup.

d) What is a recommended pattern for organization of resources into external resource dictionaries?
Where there is no single pattern that I have noticed and it really depends on your scenario, an interesting data point is that the Blend source code itself only consists of a few resource dictionaries - we have one for a bunch of colors and brushes, and one for the styles for the common controls we use in our UI. Of course, we have two sets of these - one each for the Expression Dark and Light themes. Of course, fewer number of resource dictionaries helps with better performance inside Expression Blend.

e) What if I was instantiating resources from code? How can I make my application more design-time friendly?
Here is a blog post that might help.