Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find position of Button/UIElement on screen relative to grid Windows Phone

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?

like image 992
James Mundy Avatar asked Nov 21 '11 01:11

James Mundy


1 Answers

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?.

like image 58
Filip Skakun Avatar answered Oct 14 '22 09:10

Filip Skakun