MenuItem popup event

  • Thread starter Thread starter xen0x
  • Start date Start date
X

xen0x

Hey,

I have a context menu which is being built dynamically.
The menu has regular items and group items which contain sub menu
items.

I didn't want to create the menu all at once, so I decided I will
create the sub menus on the popup event of the parent menu item.

The trouble is that the event handler that I registered on popup is
never called (I did add a dummy menu item, so the popup SHOULD fire).
I tried registering the select event and that 1 works.

Any1 has a clue?!

MenuItem GroupMenuItem = new MenuItem(FolderName); //create group menu
for folder

GroupMenuItem.MenuItems.Add(""); //add dummy menu item so it will
display as a group and raise the Popup event

GroupMenuItem.Popup += new EventHandler(GroupMenuItem_Popup); //assign
popup event handler

DynamicMenu.MenuItems.Add(GroupMenuItem); //add new group menu

when i select the groupmenuitem, the function GroupMenuItem_Popup is
never called, altough i checked in debug and onPopup has this
function...
 
Hi

Try like this:

MenuItem GroupMenuItem = new MenuItem(FolderName,new
EventHandler(GroupMenuItem_Popup));
DynamicMenu.MenuItems.Add(GroupMenuItem);

Regards
Sooraj
Microsoft Community Star
 
Back
Top