private static void MoveBottomEdgeOfWindowToMousePosition(PopupWindow window, double width) { var transform = PresentationSource.FromVisual(window).CompositionTarget.TransformFromDevice; var mouse = transform.Transform(new Point(PT.X, PT.Y)); window.Left = mouse.X - width - 15; window.Top = mouse.Y - 20; window.InvalidateVisual(); }