I have a Canvas with two or more objects.
Now, I put these objects in a new Canvas placed in the pre开发者_C百科vious Canvas. Then, I rotate it.
Now, I want to know how to get the positions of the objects in the new Canvas, as though there were no new canvas.

You can use the following extension method to get the location of one UIElement with respect to another:
public static class ExtensionMethods
{
public static Point GetRelativePosition(this UIElement element, UIElement other)
{
return element.TransformToVisual(other)
.Transform(new Point(0, 0));
}
}
加载中,请稍侯......
精彩评论