Collapse menu on item_click

Sep 10, 2009 at 10:23 AM

What I can not find to work is when I click on an item to close the menu.

Found the method collapsedropdown but this does not work.

 

Following code is written in my item_click

((MenuItem)sender).CollapseDropDown();

 

Does anyone have a solution for this?

thanks

Sep 10, 2009 at 1:28 PM

Allready found the solution,

you have to think big, you want to close the menubar not just an item

following code works in the item_click event

MenuItem mi = sender as MenuItem;

restart:

if(mi.parentMenuBarItem == null)

{

mi = mi.parentMenuItem;

goto restart;

}

else

{

mi.parentMenuBarItem.CollapseDropDown();

}