Path 获取画布中路径的左侧

Path 获取画布中路径的左侧,path,Path,我试图使用Canvas.GetLeft(aPath)找到路径的左边; 但是我得到了0分。 我试着打电话给aPath.Measure,成功地得到了想要的尺寸,它有宽度,但有没有办法得到aPath的左边。 请帮忙。 谢谢 N我遇到了类似的问题,并发现使用VisualTreeHelper.GetOffset()有效: 祝你好运 Vector offset = VisualTreeHelper.GetOffset(myPath); //moving the path around the canvus

我试图使用Canvas.GetLeft(aPath)找到路径的左边; 但是我得到了0分。 我试着打电话给aPath.Measure,成功地得到了想要的尺寸,它有宽度,但有没有办法得到aPath的左边。 请帮忙。 谢谢
N

我遇到了类似的问题,并发现使用VisualTreeHelper.GetOffset()有效:

祝你好运

Vector offset = VisualTreeHelper.GetOffset(myPath);

//moving the path around the canvus just a bit
Canvas.SetTop(myPath, offset.X + 100);
Canvas.SetLeft(myPath, offset.Y + 100);