/// <summary> /// Check if mouse button was released on top of a menu item. /// </summary> /// <param name="args">Mouse event arguments.</param> protected override void MouseUpIntercept(MouseEventArgs args) { if (this.isPopUpShown && CheckCoordinates(args.Position.X, args.Position.Y)) { // Check if a child menu item should be clicked foreach (MenuItem item in this.menuItems) { MenuButton button = item as MenuButton; if (button == null) { continue; } if (button.CheckCoordinates(args.Position.X, args.Position.Y)) { button.InvokeClick(); break; } } } }
/// <summary> /// Child menu item has closed its popup. /// </summary> /// <param name="sender">Menu item closing its popup.</param> protected void OnPopUpClosed(object sender) { this.selectedMenuItem = null; }
/// <summary> /// Child menu item has opened its popup. /// </summary> /// <param name="sender">Menu item opening its popup.</param> protected void OnPopUpOpened(object sender) { this.selectedMenuItem = (MenuButton)sender; }