• 0

[C#] Custom control not seeing dictionaries even though in the debugger I c


Question

So I've been at this since last night. I just want to have a custom solidbrush defined in a resource dictionary and then have all of my custom controls be able to see it. so I've tried using C# code and I've tried using the generic.xaml file. No matter what way I do it, I can see the resource dictionary during the construction of the control (if I use code behind), then I can't see it during the time it's being applied (resources shows up as having 0 keys/values).

generic.xaml:

<ResourceDictionary.MergedDictionaries>

<ResourceDictionary Source="ms-appx:///Test.CustomControls.Test/Themes/Styles.xaml" />

</ResourceDictionary.MergedDictionaries>

The generic.xaml compiles fine and does not complain at not being able to find that resource. Why can't my controls see it? I have a solid brush keyed as MActiveColorBrush.

EDIT: If I put it directly into the top elements resources then it works. But I would like to have a one line piece that then embeds the resource dictionary in every control of generic.xaml. Can this not be done? If not why does it let you designate merged dictionaries at the root level of the generic.xaml?

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

This topic is now closed to further replies.