Each Dictionary entry must have an associated key attribute

匿名 (未验证) 提交于 2019-12-03 02:02:01

问题:

I am programming w Windows 8.1 App using C# and the MVVM-Light Toolkit from GalaSoft.

All I have is the code below:

The error "Each Dictionary entry must have an associated key attribute" occurs and only disappears when I either remove

    

or

    

Can anyone tell me what the problem here is?

回答1:

Note that Application.Resources requires an instance of ResourceDictionary, so you have to do something like this:

So it's not strange at all, it's also not a bug. If you want your ResourceDictionary to be treated as a resource, you of course have to provide some Key for it, however in this case you really want to assign an instance of ResourceDictionary to the Application.Resources



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!