XAML - MergedDictionaries throwing XmlParseException “item has already been added”. Why?

If your resources are not located in a separate file, then they shouldn't be part of the merged dictionaries. Move them outside like this.

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

I have the following, very easy to reproduce problem: I'm creating a xaml application which uses resources from another file. The way to go is to create a MergedDictionaries-tag to merge the local and global resources, like this: .... This little piece of code will crash if you run it: Item has already been added. Key in dictionary: 'System.Windows.Controls.

Border' Key being added: 'System.Windows.Controls. Border' If we remove the MergedDictionaries-tag, the code will run as expected: I don't understand why it throws the exception when we use Merged Resources. Off course, the fix is easy enough for now (move the resources to a lower level).

It would be nice to know if this is 'normal' behavior... wpf xaml styles resourcedictionary link|improve this question edited Aug 15 '11 at 19:23Dave Clemmer1,78331030 asked Jan 11 '10 at 9:13Roel2,062520 73% accept rate.

Additional information for people searching for that specific error message: I encountered this problem when accidentally using two styles with the same TargetType and no x:Key attribute. Removing one of them (e.g. By merging its contents into the other) solved this problem for me. – Jan Jan 13 at 16:19.

If your resources are not located in a separate file, then they shouldn't be part of the merged dictionaries. Move them outside like this: That said, the error message is a little misleading and may be a result of a bug in the XAML compiler.

Ok I see, thanks for the information! – Roel Jan 11 '10 at 10:06.

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