I have a project CommonStyles.exe with different styles. My application has a reference to the CommonStyles.exe. Styles are declared in App.xaml (via ResourceDictionary.MergedDictionaries
).
I use styles from CommonStyles.exe in my application with StaticResource
.
The application works perfectly at runtime, but in design mode I get this error (Visual Studio 2010):
“Provide value on ‘System.Windows.Markup.StaticResourceHolder’ threw an exception.”
This problem is solved if I include the project containing CommonStyles.exe in solution with my application.
The solution on question Avoiding Visual Studio designer errors when WPF resource is defined in separate project
is to use DynamicResource
rather than StaticResource
. But in this solution Visual Studio displays the controls without styling in design mode. I need to look applying styles in design mode.
So Visual Studio in design mode can't find some styles, but in runtime can.
I try to realize this solution https://stackoverflow.com/a/1111473/5152001 but in design mode I get error for some control like this:
Cannot locate resource "SomeStyleBase"
This control use style "SomeStyle" from CommonStyles.exe. Style "SomeStyle" inherit on style "SomeStyleBase" from CommonStyles.exe. This styles are in different files. This problem is solved if I merge this styles in one file. But this solution is not suitable for me.
So I had to include the project containing CommonStyles.exe in solution with my application until I will find better solution.