silverlight 3设计错误 [英] silverlight 3 designing error

查看:70
本文介绍了silverlight 3设计错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<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".

推荐答案

问题是您使用的是合并字典而不是您的典型资源.在这种情况下,您只能有一个UserControl.Resources标记的子元素(您称之为集合").这是因为您基本上是在说不是在这里定义字典,而是要定义将哪些其他字典组合成字典".从出现错误的行中删除x:Key,就可以了.
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.


这篇关于silverlight 3设计错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆