Posted 16 years ago
by David Mullin
Version: 9.1.0502
Platform: .NET 3.5
Environment: Windows 7 (64-bit)

(I'll admit up front that this may not actually be a bug, but rather a feature...but it seems like an odd behavior.)
If I have a SyntaxEditor control on my window, and I say controlInstance.ContextMenu.Items.Add(...), the SyntaxEditor's Context Menu is modified accordingly - so far, so good.
However, if I close that window and create it again, the SyntaxEditor on the second window will now have the additional the ContextMenu twice. It appears that all instances of the SyntaxEditor share a common ContextMenu.
This presents a further problem in that, since the first window no longer exists, the delegate call for the previously added MenuItem no longer exists, so selecting that MenuItem results in an exception.
I imagine that I could write a routine that walks a ContextMenu and does a deep clone of all of the items, but that would be really painful and I'd rather avoid that.
Is there something that I'm missing here?
David Mullin
[Modified at 08/04/2009 06:56 PM]
If I have a SyntaxEditor control on my window, and I say controlInstance.ContextMenu.Items.Add(...), the SyntaxEditor's Context Menu is modified accordingly - so far, so good.
However, if I close that window and create it again, the SyntaxEditor on the second window will now have the additional the ContextMenu twice. It appears that all instances of the SyntaxEditor share a common ContextMenu.
This presents a further problem in that, since the first window no longer exists, the delegate call for the previously added MenuItem no longer exists, so selecting that MenuItem results in an exception.
I imagine that I could write a routine that walks a ContextMenu and does a deep clone of all of the items, but that would be really painful and I'd rather avoid that.
Is there something that I'm missing here?
David Mullin
[Modified at 08/04/2009 06:56 PM]