I need to programatically obtain the client coordinates where a panel (stackpanel for instance) is located. When using the Windows API, a button has a TopLeft and BottomRight coordinate that determines its location within the window in which it resides. How do I obtain those coordinates for a stackpanel in a WPF window ?
Thank you for your help,
John.
You can call TransformToVisual()
which gets a GeneralTransform relative to some other element for which you can use your container (frame/ window)
GeneralTransform gt = stackPanel1.TransformToVisual(parentWindow);
Point p = gt.Transform(new Point(0, 0));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.