Jump to content



Photo
c# windows 8 resource dictionary

  • Please log in to reply
No replies to this topic

#1 sathenzar

sathenzar

    Neowinian

  • Joined: 12-June 06

Posted 12 January 2013 - 16:03

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?