I have a context menu attached to a panel, that should mirror commands available in a toolbar menu.
Currently in my MouseUp
event, I set the enabled
state of the MenuItem
s, and add them to the context menu:
ctxMnuLinks.Items.Clear()
ctxMnuLinks.Items.Add(mnuLinksOpen)
ctxMnuLinks.Items.Add(New ToolStripSeparator)
ctxMnuLinks.Items.Add(mnuLinksAdd)
ctxMnuLinks.Items.Add(mnuLinksEdit)
ctxMnuLinks.Items.Add(New ToolStripSeparator)
...
..but this removes the items from the toolbar menu! So obviously I can't use the same object. I would like to avoid duplicating the menu, which would leave me 2 sets of menu items to maintain.
What is the proper way to achieve this? I'm looking for a 'best practice' answer.