4

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.

Community
  • 1
  • 1
Nata
  • 41
  • 3
  • You need to look at the inner exception to see the detail of the problem – Glen Thomas Sep 16 '15 at 07:16
  • This error is in design mode (not in runtime) when I look windows xaml code. How can I look inner exception? – Nata Sep 16 '15 at 09:00
  • possible duplicate of [Avoiding Visual Studio designer errors when WPF resource is defined in separate project](http://stackoverflow.com/questions/1088762/avoiding-visual-studio-designer-errors-when-wpf-resource-is-defined-in-separate) – Glen Thomas Sep 16 '15 at 09:31
  • thanks for the link but I need to look applying styles in design mode (I edit my question) – Nata Sep 16 '15 at 12:34
  • That is the accepted answer. Have you read [this answer](http://stackoverflow.com/a/1111473/5152001)? – Glen Thomas Sep 16 '15 at 13:55
  • I try to realize this solution, but I get other error (I described it in my question) – Nata Oct 09 '15 at 07:55

0 Answers0