eugenedotnet home
history      administration      file management


Follow eugenedotnet on Twitter








Get coordinates of an UI element

This method will help you to get XY coordinates (point) of an UI element:

/// <summary>
/// Method to get XY coordinates of an element
/// </summary>
/// <param name="element">UI element to get XY coordinates from</param>
/// <returns>Point representing XY coordinates</returns>
private Point GetCoordinatesOfElement(UIElement element)
{
   GeneralTransform gt = element.TransformToVisual(Application.Current.RootVisual as UIElement);
   return gt.Transform(new Point(0, 0));
}

ScrewTurn Wiki version 3.0.3.555

Guest - Plans - Presentation - Links - Login