I can't find a way to get the position in (x,y) co-ordinates of an on-screen control like a button relative to the grid that it is inside. Is there a way to do this that I am overlooking?
Asked
Active
Viewed 1.1k times
1 Answers
22
var transform = button.TransformToVisual(grid);
Point absolutePosition = transform.Transform(new Point(0, 0));
From How to get the position of an element in a StackPanel?.

Community
- 1
- 1

Filip Skakun
- 31,624
- 6
- 74
- 100
-
1I am always getting 0,0 in absolutePosition. What I am doing wrong?, – fhnaseer Jan 26 '15 at 12:12