The Short Version How do you handle static resource look ups in UserControls that get embedded into other windows/user/custom controls? So that Blend 4 might render it properly @ design time something Visual Studio already does for you.
The Long Version As the question suggests, we have a window that has some embedded user controls and the window as well each as embedded user control all use static resource markup extensions to resolve references to resources found in a merged dictionary in the app.xaml file.
Blend has no problems loading and rendering any of my sample user controls that I made in the VS Designer Surface when opened individually. It has no problems resolving the countless static resource mark up extensions I employ pretty much everywhere.
Whenever I try to open my 'MainWindow.xml', (a window control) I noticed that I was getting 4 - Cannot Create Instance Of Type errors with Blend 4 nicely telling me on the ArtBoard that it has caught some design time exceptions. Digging further down into these exceptions by attaching the VS debugger instance to Blend I noticed that every single Static Resource I referenced, it complained it cannot find it.
As a comparison I looked at a custom control that I created, it did not employ any static resources at all they were local resources instead. This custom control when embedded into a UserControl I noticed worked pretty nicely. I think it is obvious why!
Does any one on SO, have any ideas how to get around this problem? I tried the whole 'Add a Design-Time Dictionary' <-- which works partially, embedded user controls still are not created at all !
Research
- MVVM Light + Blend designer view error: Cannot find resource named 'Locator'
- Theming using resources without Blend vomitting
UPDATE: Possible Solutions:
- Employ a simialr approach presented here: GianlucaCucco Answer
- Convert all static resource look ups to local resources for UserControls?
- Convert all static resource look ups to dynamic resources instead.
Neither of these solutions are pretty. = (