0
我想查找UIElement
的Left,Top,Right,Bottom
。我尝试过但没有结果。如何获取WPF中UIElement的左,上,右,底点?
任何人都可以在这里有任何想法如何得到这些?
其实,我正在WPF中创建一个自定义面板。
我不想从画布继承。
Size elemSize = this.ElementBeingDragged.DesiredSize;
// Get the element's offsets from the four sides of the Panel.
Vector v= VisualTreeHelper.GetOffset(this.ElementBeingDragged);
double left = v.X;
double right = v.X + elemSize.Width;
double top = v.Y;
double bottom = v.Y+elemSize.Height;
我已经放置我的代码 –
您是否尝试过TranslatePoint或TransformToAncestor? – Josh