WPF Application ResourceDictionary problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • blackirish
    New Member
    • Sep 2008
    • 22

    WPF Application ResourceDictionary problem

    Hi all,
    I am writing a WPF application which uses styles to visualize controls in the application. I use separate resource dictionaries. ControlTemplate s.xaml, Animations.xaml and a folder named Colors including different resource dictionaries to change the control colors on the fly. I am using MergedDictionar ies to load styles such that;

    <ResourceDictio nary.MergedDict ionaries>
    <ResourceDictio nary Source="/Styles;componen t/Styles/Colors/BlueColors.xaml "/>
    <ResourceDictio nary Source="/Styles;componen t/Styles/Animations.xaml "/>
    <ResourceDictio nary Source="/Styles;componen t/Styles/ControlTemplate s.xaml"/>
    </ResourceDiction ary.MergedDicti onaries>
    Then i get an exception when loading resources like;

    "A first chance exception of type 'System.Windows .Markup.XamlPar seException' occurred in PresentationFra mework.dll

    Additional information: Cannot find resource named '{BackgroundBru sh}'. Resource names are case sensitive. Error at object 'System.Windows .Media.Animatio n.SplineColorKe yFrame' in markup file 'Styles;compone nt/Styles/Animations.xaml ' Line 81 Position 34."

    When i add the BlueColors.xaml resource dictionary in the Animations.xaml file everything works well. I need to use those resource dictioaries in separate files because all resources except color resources are common throughout the application.

    Any help would be greatly appreciated.
  • Sevententh
    New Member
    • Jul 2009
    • 1

    #2
    In dictionary ControlTemplate s add this to the beginning:

    <ResourceDictio nary.MergedDict ionaries>
    <ResourceDictio nary Source="/Styles;componen t/Styles/Colors/BlueColors.xaml "/>
    </ResourceDiction ary.MergedDicti onaries>

    Comment

    Working...