Click here to Skip to main content
15,879,096 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
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.
Posted

1 solution

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[^]
 
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