user3683303
user3683303

Reputation: 51

Can I create Resources property for my own class?

I have class which doesn't have Resources property but I need a kind of resources in it. I tried to create it as ResourceDictionary and tried to work with it as it is common resource dictionary, but I get an exception when xaml-file is parsed. Should I do something special? Does anyone have such experience?

Upvotes: 1

Views: 217

Answers (1)

John Bowen
John Bowen

Reputation: 24453

You should not be trying to create your own property to shoehorn into the existing resource system. Your class should be derived from FrameworkElement (or one of its derivatives) which has the common Resource property on it that works with the built in hierarchical resource system.

Upvotes: 2

Related Questions