Sys
Sys

Reputation: 413

WPF CustomControl - Resources Property

I have CustomControl deriving from another control in which I set the default styles 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.

Upvotes: 1

Views: 1529

Answers (2)

Achilleterzo
Achilleterzo

Reputation: 742

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

Upvotes: 1

fenriv
fenriv

Reputation: 71

There is couple solutions:

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

  2. Add new resources as resource dictionary.

Upvotes: 0

Related Questions