There's a good explanation of the problem on StackOverflow:
c# - Windows Style from ResourceDictionary don't apply - Stack Overflow[
^]
Basically, the
Window
is created before the nested
ResourceDictionary
is processed. At that point, nothing defined in the
<Window.Resources>
dictionary is available.
If you use a
StaticResource
, the designer will fail and the application will crash.
If you use a
DynamicResource
, the window will initially be created without the resource being applied; once the nested
ResourceDictionary
has been processed, and its resources are available, the window style will be updated.
A better solution is to move your resources to the
<Application.Resources>
dictionary, which
is processed before the window is created.