Esempio n. 1
0
        protected void TitleBarMouseUp(object sender, MouseButtonEventArgs e)
        {
            if (!ShowIconOnTitleBar)
            {
                return;
            }

            _isMouseDown = false;

            var mousePosition = GetCorrectPosition(this);

            if (mousePosition.X <= RibbonProperties.GetTitleBarHeight(this) &&
                mousePosition.Y <= RibbonProperties.GetTitleBarHeight(this))
            {
                if ((DateTime.Now - lastMouseClick).TotalMilliseconds <= doubleclick)
                {
                    Close();
                    return;
                }
                lastMouseClick = DateTime.Now;

                ShowSystemMenuPhysicalCoordinates(this, PointToScreen(GetCorrectPosition(this)));
            }
            else if (e.ChangedButton == MouseButton.Right)
            {
                ShowSystemMenuPhysicalCoordinates(this, PointToScreen(GetCorrectPosition(this)));
            }
        }
Esempio n. 2
0
        private void UpdateWindowChrome()
        {
            var windowChrome = WindowChrome.GetWindowChrome(this);

            if (windowChrome == null)
            {
                windowChrome = new WindowChrome();
                WindowChrome.SetWindowChrome(this, windowChrome);
            }

            windowChrome.CaptionHeight         = RibbonProperties.GetTitleBarHeight(this);
            windowChrome.CornerRadius          = this.CornerRadius;
            windowChrome.GlassFrameThickness   = this.GlassBorderThickness;
            windowChrome.ResizeBorderThickness = this.ResizeBorderThickness;
#if NET45
            windowChrome.UseAeroCaptionButtons = this.CanUseDwm;
#endif
        }
Esempio n. 3
0
        private void HandleIconMouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Left)
            {
                if (e.ClickCount == 1)
                {
                    e.Handled = true;

                    ShowSystemMenuPhysicalCoordinates(this, this.PointToScreen(new Point(0, RibbonProperties.GetTitleBarHeight(this))));
                }
                else if (e.ClickCount == 2)
                {
                    e.Handled = true;

                    this.Close();
                }
            }
            else if (e.ChangedButton == MouseButton.Right)
            {
                e.Handled = true;

                this.RunInDispatcherAsync(() =>
                {
                    var mousePosition = e.GetPosition(this);
                    ShowSystemMenuPhysicalCoordinates(this, this.PointToScreen(mousePosition));
                });
            }
        }
Esempio n. 4
0
        private void HandleIconMouseDown(object sender, MouseButtonEventArgs e)
        {
            switch (e.ChangedButton)
            {
            case MouseButton.Left:
                if (e.ClickCount == 1)
                {
                    e.Handled = true;

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

                    this.Close();
                }
                break;

            case MouseButton.Right:
                e.Handled = true;

                this.RunInDispatcherAsync(() =>
                {
                    WindowSteeringHelper.ShowSystemMenuPhysicalCoordinates(this, e);
                });
                break;
            }
        }