private static void RightButtonDownShow(object sender, System.Windows.Input.MouseButtonEventArgs e) { var element = (UIElement)sender; var targetWindow = element.GetValue(TargetWindow) as Window; var showMenuAt = targetWindow.PointToScreen(Mouse.GetPosition((targetWindow))); SystemMenuManager.ShowMenu(targetWindow, showMenuAt); }
private static void LeftButtonDownShow(object sender, System.Windows.Input.MouseButtonEventArgs e) { if (leftButtonToggle) { var element = ((UIElement)sender).GetValue(LeftButtonShowAt); var showMenuAt = ((Visual)element).PointToScreen(new Point(0, 0)); var targetWindow = ((UIElement)sender).GetValue(TargetWindow) as Window; SystemMenuManager.ShowMenu(targetWindow, showMenuAt); leftButtonToggle = !leftButtonToggle; } else { leftButtonToggle = !leftButtonToggle; } }