示例#1
0
        private void HandleIconMouseDown(object sender, MouseButtonEventArgs e)
        {
            switch (e.ChangedButton)
            {
            case MouseButton.Left:
                if (e.ClickCount == 1)
                {
                    e.Handled = true;

                    WindowSteeringHelper.ShowSystemMenu(this, this.PointToScreen(new Point(0, this.TitleBarHeight)));
                }
                else if (e.ClickCount == 2)
                {
                    e.Handled = true;

#pragma warning disable 618
                    ControlzEx.Windows.Shell.SystemCommands.CloseWindow(this);
#pragma warning restore 618
                }

                break;

            case MouseButton.Right:
                e.Handled = true;

                WindowSteeringHelper.ShowSystemMenu(this, e);
                break;
            }
        }
        /// <summary>
        /// Invoked when an unhandled <see cref="E:System.Windows.UIElement.MouseRightButtonUp"/> routed event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.Windows.Input.MouseButtonEventArgs"/> that contains the event data. The event data reports that the right mouse button was released.</param>
        protected override void OnMouseRightButtonUp(MouseButtonEventArgs e)
        {
            base.OnMouseRightButtonUp(e);

            if (this.IsEnabled)
            {
                WindowSteeringHelper.ShowSystemMenu(this, e);
            }
        }
        /// <inheritdoc />
        protected override void OnMouseRightButtonUp(MouseButtonEventArgs e)
        {
            base.OnMouseRightButtonUp(e);

            if (e.Handled ||
                this.IsMouseDirectlyOver == false)
            {
                return;
            }

            WindowSteeringHelper.ShowSystemMenu(this, e);
        }
示例#4
0
        /// <inheritdoc />
        protected override void OnMouseRightButtonDown(MouseButtonEventArgs e)
        {
            base.OnMouseRightButtonDown(e);

            WindowSteeringHelper.ShowSystemMenu(this, e);
        }