开发者

Silverlight Implicit styling in ControlLibrary items

I've got a Silverlight class library which contains ResourceDictionary objects with styles that I want to propagate throughout my Silverlight application. Let's call it the Theme Library. I want to use implicit styling in the Theme Library to style every control in the application.

This is sim开发者_运维百科ple to do for all the controls in the main application, just by adding the Theme Library ResourceDictionaries to the App.xaml's ResourceDictionary as MergedDictionaries. The problem I have is that I have a ControlLibrary which defines DefaultStyleKey s for some controls. Unfortunately the styles in the ControlLibrary resort back to the default styling of any controls that they are composed of and I can't change this.

Can anyone solve this issue?


I've solved this issue. I had to add the Theme's ResourceDictionary as a merged dictionary on each ResourceDictionary in the ControlLibrary as well as in the main application.

In other words the Theme's ResourceDictionary was a root ResourceDictionary which is referenced by elements both in the ControlLibrary and the application.

Unfortunately default styling didn't propagate through ControlLibrary elements, so I had to manually wire up each of the controls I wanted styling in the ControlLibrary.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜