XamlParseException occurred

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!