Home > View Post

Measuring the x,y distance between two elements in Silverlight

This is a useful thing to know if you ever want to do anything funky with Silverlight layout (for example, create an HtmlHost control that floats an iframe in exactly the right place over the plug-in):

Point point = element2.TransformToVisual(element1).Transform(new Point(0,0));

element1 to element2

This returns a point that reflects the position (point) of element2 in element1's coordinate space. Nice.

Tags: Silverlight

Josh Post By Josh Twist
3:10 AM
05 May 2009

» Next Post: My favourite underused keyword in C# is...
« Previous Post: Dogfooding Ukadc.Diagnostics

Comments are closed for this post.

Posted by kapil @ 11 Nov 2009 12:55 AM

Thanks, but i want to place htmlhost on a childwindow so that i can move html host along with childwindow

Can you help on this.

© 2005 - 2022 Josh Twist - All Rights Reserved.