예제 #1
0
        /// <summary>
        /// If any menu is currently open, automatically open popups when the
        /// mouse hovers over the menu item.
        /// </summary>
        /// <param name="args">Mouse event arguments.</param>
        protected override void MouseMoveIntercept(MouseEventArgs args)
        {
            if (this.isPopUpShown && CheckCoordinates(args.Position.X, args.Position.Y))
            {
                foreach (MenuItem item in menuItems)
                {
                    MenuButton button = item as MenuButton;
                    if (button == null)
                    {
                        continue;
                    }

                    if (button.CheckCoordinates(args.Position.X, args.Position.Y))
                    {
                        if (button != this.selectedMenuItem)
                        {
                            if (this.selectedMenuItem != null)
                            {
                                this.selectedMenuItem.ClosePopUp();
                            }

                            button.SelectByMove();
                        }
                        break;
                    }
                }
            }
        }
예제 #2
0
        /// <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;
                    }
                }
            }
        }