Exemplo n.º 1
0
        /// <summary>
        /// Show system menu on MouseRightButtonUp
        /// </summary>
        /// <param name="window"></param>
        /// <param name="e"></param>
        internal static void DoThumbMouseRightButtonUp(Window window, MouseButtonEventArgs e)
        {
            if (window.ShowSystemMenu)
            {
                // show menu only if mouse pos is on title bar or if we have a window with none style and no title bar
                var mousePos = e.GetPosition(window);
                if ((mousePos.Y <= window.TitleBarHeight && window.TitleBarHeight > 0) || (window.UseNoneWindowStyle && window.TitleBarHeight <= 0))
                {
#pragma warning disable 618
                    SystemCommands.ShowSystemMenu(window, window.PointToScreen(mousePos));
#pragma warning restore 618
                }
            }
        }
Exemplo n.º 2
0
        private void OnIconMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (!ShowSystemMenu)
            {
                return;
            }

            if (e.ClickCount == 2)
            {
                Close();
            }
            else
            {
#pragma warning disable 618
                SystemCommands.ShowSystemMenu(this, PointToScreen(new Point(0, TitleBarHeight)));
#pragma warning restore 618
            }
        }