Beispiel #1
0
        private static void RightButtonDownShow(object sender, MouseButtonEventArgs e)
        {
            UIElement element = (UIElement)sender;

            Window targetWindow = element.GetValue(TargetWindow) as Window;

            Point showMenuAt = targetWindow.PointToScreen(Mouse.GetPosition(targetWindow));

            SystemMenuManager.ShowMenu(targetWindow, showMenuAt);
        }
Beispiel #2
0
        private static void LeftButtonDownShow(object sender, MouseButtonEventArgs e)
        {
            if (leftButtonToggle)
            {
                object element = ((UIElement)sender).GetValue(LeftButtonShowAt);

                Point showMenuAt = ((Visual)element).PointToScreen(new Point(0, 0));

                Window targetWindow = ((UIElement)sender).GetValue(TargetWindow) as Window;

                SystemMenuManager.ShowMenu(targetWindow, showMenuAt);

                leftButtonToggle = !leftButtonToggle;
            }
            else
            {
                leftButtonToggle = !leftButtonToggle;
            }
        }