ResourceDictionary in application resources cannot be found?

This is because if you have a resource dictionary as the only item in the resources section then the contents simply get added to the parent dictionary (I snooped and this seems to be the case). To get around this you need to put your resource dictionary in separate xaml file (List. Xaml in this case).

Up vote 0 down vote favorite share g+ share fb share tw.

I'm facing some strange issue with a ResourceDictionary in my Application.Resources. In order to fill multiple ComboBoxes inside my application, I want to store the data in a ResourceDictionary. However, I get the "Cannot find a Resource with that Name/Key..." error constantly.

My XAML-Code here: Item1 Item2 Item3 Due to some lucky circumstances I was able to find out that putting another resource like Style above the Dictionary solves the problem. Item1 Item2 Item3 The "bug" occurs in a WPF application as well as in Silverlight. Although I can solve this using the shown "trick", I am curious where this error is coming from.

I wasn't able to find anything about this. Maybe it is just me and something I am understanding wrong about resources in WPF. Wpf xaml resources resourcedictionary staticresource link|improve this question asked Mar 21 '11 at 10:21Christoph11.

You may want to use the x:Array markup extension instead. That allows you to define lists of items in XAML. – CodeNaked Mar 21 '11 at 12:42.

This is because if you have a resource dictionary as the only item in the resources section then the contents simply get added to the parent dictionary (I snooped and this seems to be the case). To get around this you need to put your resource dictionary in separate xaml file (List. Xaml in this case): Item1 Item2 Item3 and then reference that in your main app.

Thanks for your answer. In my real application I created that separated file, but I didn't make a second ResourceDictionary inside of it a nd just put the string values there. So it looked like: Item1 Item2 Item3 So this was of course not working either.

Thanks for your answer, definitely solves this one.

Thanks, glad it worked - Quick point for the future - you need to mark the answer as accepted and your 'answer' should be a comment on mine. Its not the same as a forum :) – Leom Burke Mar 22 '11 at 8:46.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions