locked
Expression Blend 3 gives Key Attribute Error on Sample Code RRS feed

  • Question

  • In Microsoft's Slidentity sample code the following XAML gets an error "The Key attribute can only be used on an element that is contained in 'IDictionary'". The Page.xaml file will not dispaly in EB3. The project compiles OK in VSTS 2008. I can not find any details on this error. What is wrong and how do I fix it.
    <UserControl.Resources>
            <ResourceDictionary x:Key="Collection" >
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary x:Name="dict" Source="/Resources.xaml" />
                </ResourceDictionary.MergedDictionaries>
            </ResourceDictionary>
        </UserControl.Resources>
    Thursday, October 8, 2009 5:09 PM

All replies

  • I had a similar problem with the Slidenty code. Here is the solution that I found:

    Move x:Key="Collection" entry as shown in the following XAML code sample.

    <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries x:Key="Collection" >

    There are several places within the project where this must be done. I used VS 2008 to search and replace across the entire project.

    Hope this helps others.

    • Proposed as answer by petevzh Friday, September 28, 2012 6:53 AM
    Saturday, July 10, 2010 2:07 PM
  • Microsoft, please fix this bug from Bled 3, Blend 4, Blend 5 and future version

    When remove "x:Key" evrething is OK. This error not happing in VS, only if Blend

    Friday, September 28, 2012 6:54 AM