I want to find the Left,Top,Right,Bottom
of an UIElement
. I tried but failed with no result.
Can anyone here have any idea how to get these?
Actually, I am creating a custom panel in WPF.
I dont want to inherit from Canvas.
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;