开发者

WPF CustomControl - Resources Property

开发者 https://www.devze.com 2023-02-14 08:33 出处:网络
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

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

精彩评论

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