How do I find the geographic coordinates of the mouse when it is over the xamGeographicMap? I need to know when the user clicks on a specific ShapefileRecord. the xamGeographicMap.MouseLeftButtonDown doesn't return this information. If I can just get the coordinates of the mouse at the time, I can figure it out myself.
Thanks.
Hello Rvassar,
Thank you for the feedback. I am glad, that you have found a solution to your issue.
I already knew about e.GetPosition. That gets the pixel coordinates, not the geographic coordinates. I was able to get it from the MapCrosshair sample though.
I am just checking if you have any further questions on this matter. Please do not hesitate to let me know if you do.
Hello RVassar,
Thank you for your post!
I have been looking into your question. You can get the mouse coordinates using the GetPosition method of the MouseButtonEventArgs from the PreviewMouseLeftButtonDown event. You can use the following line:
var mousePosition = e.GetPosition(this.GeoMap);
Also, I can suggest to take a look at our samples browser, that is installed on your computer together with our controls. In the section for the XamGeographicMap you would be able to find a sample, names "Map Crosshair", where it is shown, how to get Longitude, Latitude and X and Y coordinates.
Please do not hesitate to let me know if you have any further questions on this matter.