开发者

Applying global style across multiple assemblies

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 wi开发者_开发技巧th 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜