I've created a menu control in Silverlight that consists of a menuitem class and a menuitem collection class. Each menuitem holds a menuitemcollection of subitems, so that I can easily build out a tree of menus. I need to know the best practice for hiding submenus. This menu should behave just like the menus in any Windows app. Should menu state be maintained in a separate class? Right now, I'm checking to see if the mouse pointer is in a submenu or its parent menu item, and if so, keeping it open. The problem is, I'm using the MouseEvent and the point from the MouseEventArgs, and if you move the mouse quickly, the values aren't tracked properly.
Anyway, what's a good practice for hiding nodes? Do you use recursion to close all the old submenus when the mouse moves onto a new parent node? Again, this is just the typical windows-app menu behavior. There must be an example of this somewhere. Thanks!