locked
How do you reference a system theme ResourceDictionary resource in generic.xaml? RRS feed

  • Question

  • I "think" I've merged the ResourceDictionary properly:

    <ResourceDictionary.MergedDictionaries>

    <ResourceDictionary Source="/PresentationFramework.Aero2;component/themes/aero2.normalcolor.xaml" />

    </ResourceDictionary.MergedDictionaries>


    Now how do I reference one of the brushes defined in it?

    Wednesday, March 13, 2013 8:19 PM

All replies

  • Hi Countalpha,

    You can refer the brushes by just giving the resource key and this will search for all the keys which are merged to that ResourceDictionary.  


    sankar

    • Proposed as answer by sankarann Monday, March 25, 2013 12:29 PM
    Thursday, March 14, 2013 4:26 AM
  • Would you be able to tell me why this resource:

    <SolidColorBrush x:Key="TextBox.MouseOver.Border" Color="#FF7EB4EA" />

    from aero2.normalcolor.xaml gives me an exception with the following message "{"Cannot find resource named 'TextBox.MouseOver.Border'. Resource names are case sensitive."}"? I'm merging the dictionary as noted above, and it's not failing with a file not found, etc.

    I got to think this is being done by "some" people, as opposed to just redefining brushes over and over again. Thanks for the reply.

    Thursday, March 14, 2013 1:52 PM
  • Yes this will work for sure. Here the exception was thrown as Cannot find the resource name, so i think the appropriate resource file was not merged correctly. 

    Sankar

    Friday, March 15, 2013 7:27 AM
  • Do you have an example how to properly address the Aero2 ResourceDictionary, and then reference the brush used for "hot tracking" or "mousover" colour?
    Friday, March 15, 2013 3:34 PM