private static Rect GetRectFromRoot(UIElement root) { return new Rect( root.PointToScreen(new Point()), root.PointToScreen(new Point(root.RenderSize.Width, root.RenderSize.Height)) ); }
internal static Point ToScreen(this Point self, UIElement element) { return element.PointToScreen(self); }
internal static Rect ToScreen(this Rect rect, UIElement element) { var topLeft = element.PointToScreen(rect.TopLeft); var bottomRight = element.PointToScreen(rect.BottomRight); return new Rect(topLeft, bottomRight); }