Question

My application is composed from quite a few assemblies ("plug-ins") that are loaded by a core executable assembly (which doesn't contain any controls or windows on it own). Now I want to apply styles to controls (such as Menus/ContextMenus, ToolBar(Tray)s etc.) from the central assembly's Application.Resources styles (possibly with the option of users being able to choose from several themes).

I got it to work with named styles (x:Key="StyleName", invoked by DynamicResource, StaticResource wouldn't work), but the prospect of adding the Style="{DynamicResource ...}" to every control in every assembly scares me quire a little bit. But the control-wide styles with TargetType="{x:Type TypeName}" won't work no matter what I do.

How can I style all the controls en masse from one central assembly?

Thanks for help.

Was it helpful?

Solution

Perhaps this great article on WPF skinning might help point you in the right direction?

In the intro, he highlights the "three pillars" for skinning/theming and how hierarchical resources can be leveraged.

Though I do fear (without certainty) that you might still need to change your static resources to dynamic ones.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top