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?
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?.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With