Hi experts,
I want to handle an event, whenever the Submenus of a menu item opens. Same for closing. how can I do this?
Thnks in Advance Regards, Jawahar
Hi experts,
I want to handle an event, whenever the Submenus of a menu item opens. Same for closing. how can I do this?
Thnks in Advance Regards, Jawahar
Not sure what you want, but take a look at these events for ContextMenu and MenuItem:
ContextMenu: http://msdn.microsoft.com/en-us/library/system.windows.controls.contextmenu_events.aspx MenuItem: http://msdn.microsoft.com/en-us/library/system.windows.controls.menuitem_events.aspx
I think ContextMenuOpening
and ContextMenuClosing
might be interesting ;)
Very easy. Subscribe to a MenuItem's SubmenuOpened event. Traditional way to do it:
MidItem.SubmenuOpened += new RoutedEventHandler(MidItem_SubmenuOpened);
private void MidItem_SubmenuOpened(object sender, RoutedEventArgs e)
{
//Menu Open Logic Here
}
Or the cool dynamic method:
MidItem.SubmenuOpened += delegate(object sender, RoutedEventArgs e)
{
//Menu Open Logic Here
};