Showing posts with label UIElement. Show all posts
Showing posts with label UIElement. Show all posts

Monday, August 23, 2010

Find out position of an UIElement in Silverlight

Use GeneralTransform to get the position of the UI Element:

1 GeneralTransform objGeneralTransform = myObj.TransformToVisual(Application.Current.RootVisual as UIElement);
2 Point point = objGeneralTransform.Transform(new Point(0, 0));
3 double myObjTop = point.Y;
4 double myObjLeft = point.X;