The following code from MSDN come in very handy today, just change “this” to your control and it’ll give your the absolute position of your control on the page:
GeneralTransform gt = this.TransformToVisual(Application.Current.RootVisual as UIElement);
Point offset = gt.Transform(new Point(0, 0));
double controlTop = offset.Y;
double controlLeft = offset.X;
No comments:
Post a Comment