2

PART 1 (solved)

The following XAML works fine in Visual Studio 2013 (Premium, Update 5):

<Window.Resources>
  <ResourceDictionary Source="Resources/Dictionaries/Main.xaml" />
</Window.Resources>

However, when working with the same project in Visual Studio 2015 (Enterprise), it complains with the following error:

Exception: An error occurred while finding the resource dictionary "Resources/Dictionaries/Main.xaml".

A different topic concerns a similar error with Visual Studio 2012, and was apparently resolved by installing Update 1 for VS2012.

PART 2

Using the pack URI makes Visual Studio 2015 happy, but unfortunately it is still not applying inhertied styles. Interestingly, in Visual Studio 2013 designer the style is applied correctly, but not in Visual Studio 2015, and also not when the application runs!

Any Ideas?

PART 2 : UPDATE

A further (side issue), that was confusing the main issue was "static resources for the main window are only loaded after the main window definition is processed". This means that default styles (in specific, a window style) must be placed in app.xaml so that they are defined by the time the main window is loaded (otherwise they will not be applied in the designer, or in the application when it runs).

Community
  • 1
  • 1
Fortmann
  • 433
  • 6
  • 20
  • Regarding PART2 : If the window style is accessed explicity (by assigned an x:Key, and then explicitly using that style as a static resoruce, then the style is applied) – Fortmann Jul 23 '15 at 11:25

1 Answers1

3

Try the following:

<ResourceDictionary Source="pack://application:,,,/YourNamespace;component/Resources/Dictionaries/Main.xaml" />
Filippo Vigani
  • 904
  • 1
  • 9
  • 22
  • Thanks - This makes the compiler/parser happy, but unfortunately there are more glictches... A default window Style (TargetType="Window") in Mail.xaml is not applied. Again, in Visual Studio 2013 it works (the style is applied), but not in Visual Studio 2015 -_- – Fortmann Jul 23 '15 at 11:01