Hello all,

I have a context menu that I'm dynamically adding some menu items to,
but the items I'm adding just don't get displayed.

In my control's constructor I create a top-level menu item in my
context menu, and then elsewhere in the code in response to user input
I add sub-menu items to this by adding new 'MenuItem' instances to its
'MenuItems' property. When the menu pops up however it doesn't display
my dynamically created menu items.

Code to added the menu items is pretty simple:

MenuItem miNew = new MenuItem("This is the new Menu Item");
miTopLevel.MenuItems.Add(miNew);

I even handle the 'Popup' event of the context menu and test to see if
the 'miTopLevel' menu has any sub menu items in and hide it if not. If
I inspect the menu item at this point it all looks fine, my sub menu
items are added to the collection fine so the top-level menu displays,
but none of the sub-menu items do! The same code to add sub menu items
works fine when added to the constructor, just not when called from
elsewhere.

Does anyone know of any issues I need to be aware of when adding menu
items which may cause  them not to be displayed properly?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web 
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---

Reply via email to