关闭页面时出现菜单错误 [英] Menu Error on closing a page

查看:116
本文介绍了关闭页面时出现菜单错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我试过使用silverlight菜单,它很棒.关闭通过单击菜单项调用的页面时出现问题.当我关闭页面时,出现错误消息已经添加了具有相同键的项目",它源自menu.cs第521行(menuDictionary.Add(parentMenuItem.Name,parentMenuItem);)


i have tried using silverlight menu, its great. I have a problem when closing a page i had invoked by cliking a menu item. When i close the page i get an error that says "An item with the same key has already been added" and it originates from menu.cs line 521 ( menuDictionary.Add(parentMenuItem.Name, parentMenuItem);)
Any help would be appreciated.

推荐答案

menuDictionary.Add(parentMenuItem.Name,parentMenuItem);
已经添加了具有相同键的项目"
错误是不言自明的.您有重复的" parentMenuItem.Name ",或者添加了两次.

您有一个字典,其中存储键值对.错误表明您正在尝试重新添加密钥.在字典中,您不能在字典中添加重复键.
阅读: MSDN:Dictionary(Of TKey,TValue)类 [
menuDictionary.Add(parentMenuItem.Name, parentMenuItem);
An item with the same key has already been added"
Error is self explanatory. Either you have duplicate ''parentMenuItem.Name'' or you are adding it twice.

You have a dictionary where key-value pairs are stored. Error tells that you are trying to re-add a key. In dictionary you can not add duplicate key to the dictionary.
Read: MSDN: Dictionary(Of TKey, TValue) Class[^]


这篇关于关闭页面时出现菜单错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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