Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<UserControl.Resources>
    <ResourceDictionary x:Key="Collection" >("error in this line")
      <ResourceDictionary.MergedDictionaries>
         <ResourceDictionary x:Name="dict" Source="/Resources.xaml"/>
      </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</UserControl.Resources>


the error is

the "key" attribute can only be used on an element that is contained in "IDictionary".
Posted
Updated 25-Jan-10 2:06am
v2

1 solution

The problem is that you are using a merged dictionary in place of your typical resources. In this case, you can only have one child element (what you are calling "Collection") of the UserControl.Resources tag. This is because you are basically saying "rather than define the dictionary here, I am going to define which other dictionaries to combine into a dictionary". Remove the x:Key from the line with the error, and you will be fine.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900