开发者

WPF CustomControl - Resources Property

I have CustomControl deriving from another control in which I set the default st开发者_JS百科yles in its resources property (in xaml). Later, I want to use this CustomControl and add new resources to it by using the default syntax: <my:CustomControl.Resources>...

How can I do this? Currently, I get an error: Cannot re-initialize ResourceDictionary instance.


You have tried with merge?

http://msdn.microsoft.com/en-us/library/aa350178.aspx

[EDIT] The link above isn't working anymore...

This is the right answer:

Merged ResourceDictionary vs App.xaml


There is couple solutions:

  1. Add new resources to parent's resource block.

  2. Add new resources as resource dictionary.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜