XamlParseException occurred

But if you get a XamlParseException error, what are you going to search for?

I know how lost you can feel when that happens. XamlParseExceptions can be caused by a lot of things. Most of the time the troubled resource is stated in the error. But if you get the following error, what are you going to search for?


The dictionary key ‘’ is already used. Key attributes are used as keys when inserting objects into a dictionary and must be unique.

If this error occurs, it’s possible there are implicit styles that target a type more than once. In my case I got stuck with the following code after a version control update:

<Style TargetType="ComboBox" BasedOn="{StaticResource DefaultComboBoxStyle}" />
<Style TargetType="HyperlinkButton" BasedOn="{StaticResource DefaultHyperlinkButtonStyle}" />
<Style TargetType="ComboBox" BasedOn="{StaticResource DefaultComboBoxStyle}" />

Implicit style defined twice

When I removed the second ComboBox style the error was gone. I hope this helps!

Written by Loek van den Ouweland on August 06, 2010. Questions regarding this artice? You can send them to the address below.
By using this site, you acknowledge that you have read and understand our Cookie and Privacy Policy.