Example #1
0
 protected virtual void OnBaseButtonClicked(MenuItemClickEventArgs args)
 {
     if (BaseButtonClickHandler != null)
     {
         BaseButtonClickHandler(this, args);
     }
 }
 protected virtual void OnMenuItemClick(ContextMenuItem sender, MenuItemClickEventArgs e)
 {
     if (MenuItemClickHandler != null)
     {
         MenuItemClickHandler(sender, e);
     }
 }
        void MenuItem_Clicked(object sender, MenuItemClickEventArgs e)
        {
            ContextMenuItem item = sender as ContextMenuItem;

            if (item != null)
            {
                OnMenuItemClick(item, e);
                CurrentState = _STATE_DELAYHIDE;
                VisualStateManager.GoToState(this, _STATE_DELAYHIDE, false);
            }
        }
        void BaseItem_Clicked(object sender, MenuItemClickEventArgs e)
        {
            MenuItemButton item = sender as MenuItemButton;

            if (CurrentState != _STATE_EXPAND)
            {
                CurrentState = _STATE_EXPAND;
                VisualStateManager.GoToState(this, _STATE_EXPAND, true);
            }

            if (this.MenuOpenMode == MenuOpenAction.MouseHover)
            {
                this.BaseButton.MouseEnter += new MouseEventHandler(BaseItem_MouseEnter);
                this.BaseButton.Click      -= BaseItem_Clicked;
            }
        }
Example #5
0
        void MenuItem_Clicked(object sender, MenuItemClickEventArgs e)
        {
            MenuItemButton item = sender as MenuItemButton;

            if (!item.IsSelected)
            {
                ClickedItem = item;
                double x0 = (this.ContentPosition == ContentOrientation.RIGHT) ? 0 : ((this.ContentPosition == ContentOrientation.LEFT) ? ChildPanelWidth : (ChildPanelWidth / 2.0));
                double y0 = (this.ContentPosition == ContentOrientation.DOWN) ? 0 : ((this.ContentPosition == ContentOrientation.UP) ? ChildPanelHeight : (ChildPanelHeight / 2.0));
                double dx = x0 - (item.Margin.Left + item.Width / 2.0);
                double dy = y0 - (item.Margin.Top + item.Height / 2.0);

                DoubleAnimationUsingKeyFrames animationX = new DoubleAnimationUsingKeyFrames();
                animationX.KeyFrames.Add(new SplineDoubleKeyFrame()
                {
                    KeyTime = TimeSpan.FromMilliseconds(0), Value = 0
                });
                animationX.KeyFrames.Add(new SplineDoubleKeyFrame()
                {
                    KeyTime = TimeSpan.FromMilliseconds(300), Value = dx
                });

                DoubleAnimationUsingKeyFrames animationY = new DoubleAnimationUsingKeyFrames();
                animationY.KeyFrames.Add(new SplineDoubleKeyFrame()
                {
                    KeyTime = TimeSpan.FromMilliseconds(0), Value = 0
                });
                animationY.KeyFrames.Add(new SplineDoubleKeyFrame()
                {
                    KeyTime = TimeSpan.FromMilliseconds(300), Value = dy
                });

                Storyboard sbExchange = new Storyboard();
                sbExchange.Completed += new EventHandler(StoryboardExchange_Completed);
                Storyboard.SetTargetProperty(animationX, new PropertyPath("X"));
                Storyboard.SetTarget(animationX, item.RenderTransform);
                Storyboard.SetTargetProperty(animationY, new PropertyPath("Y"));
                Storyboard.SetTarget(animationY, item.RenderTransform);
                sbExchange.Children.Add(animationX);
                sbExchange.Children.Add(animationY);
                sbExchange.Begin();
            }
        }
Example #6
0
        void BaseItem_Clicked(object sender, MenuItemClickEventArgs e)
        {
            MenuItemButton item = sender as MenuItemButton;

            if (item.IsSelected && CurrentState != _STATE_EXPAND)
            {
                CurrentState = _STATE_EXPAND;
                VisualStateManager.GoToState(this, _STATE_EXPAND, true);
            }

            if (this.MenuOpenMode == MenuOpenAction.MouseHover && !isHoverModeSet)
            {
                this.SelectedButton.MouseEnter += new MouseEventHandler(BaseItem_MouseEnter);
                isHoverModeSet = true;
            }

            // Added to meet ViewPoint-GIS's need
            OnBaseButtonClicked(new MenuItemClickEventArgs(item.Tag));
        }