We have using the WPF popup control.
We need to know that how to calculate the distance / height or Y coordinate of Popup control from the Top of the screen. So, how to calculate it ?
Please see attached image for the issue screenshot.
Image for pop up with the issue
I tried two solutions as follows :
First solution -------------------------------------------------------
Window w = Application.Current.Point
relativePoint = popNonTopMostPopup.TransformToAncestor(w)
.Transform(new Point(0, 0));
Issue: It is always returns the same coordinates as relativePoint.X = 3.0 and relativePoint.Y = 25.96
My popup cotrol opens at the right side of map icons as shown in image...so when i click on different map icon, popup position is changed accordingly. So it should return the different geo-coordnates.
Second solution ----------------------------------------------------
Point position = popNonTopMostPopup.PointToScreen(new Point(0d, 0d)),
controlPosition = this.PointToScreen(new Point(0d, 0d));
position.X -= controlPosition.X;
position.Y -= controlPosition.Y;
Issue: Same issue with this solution also..it is always returning same geocoordinate every time that are position.X = 3.0 and position.Y = 49.0