Button- your button, the root is your window, and the coordinates are the coordinates of the button relative to the root.
Point coordinates = button.TransformToAncestor(root).Transform(new Point(0, 0));
Take prey in TransformToAncestor , it works for any visual.
source
share