C#.codebox 6: WPF – How to get the location of a control?

Filed under C\C++\C#, How to?, Programming, Source code
Tagged as , , , , ,

C#.codebox 6

WPF – How to get the location of a control?

1
2
3
4
5
6
7
        private Point GetControlLocation(UIElement myControl)
        {
            Vector vector = VisualTreeHelper.GetOffset(myControl);
            Point currentPoint = new Point(vector.X, vector.Y);
 
            return currentPoint;
        }

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*