Hello,
I have a XamMap with a layer which consists of a number of points and I need to output a dialog at this point's position by ElementClick. I can get WorldRect of the clicked MapElement. How can I convert it to window coordinates? Or is there any other way to get coordinates of the clicked point?
Thank you.
Hi Sergey,The following article provides information on point coordinates projecting to xamMap: link. In your case, you want to unproject the coordinates, so UnprojectFromMap could be used, for example: private void theMap_ElementClick(object sender, MapElementClickEventArgs e) { Point pt1 = theMap.MapProjection.UnprojectFromMap(new Point(e.Element.SymbolOrigin.X, e.Element.SymbolOrigin.Y)); ... }Best Regards,Milana Zhileva
Thanks for your response. But how can I get window coordinates of the clicked element?
Hi Sergey,If I am able to understand your scenario correctly, then you could try unprojecting element's WorldRect's coordinates like this:Point pt1 = theMap.MapProjection.UnprojectFromMap(new Point(e.Element.WorldRect.X, e.Element.WorldRect.Y));
or use its Width and Height for a more precise calculation.Hope this helps,Milana Zhileva
Using the code you provided I can get geodetic coordinates of the MapElement. But I need to obtain window coordinates of the clicked element (in my case elements' width and height equals 0) so that I could output seperate window in the same position as tooltip appears. Also I need to take into account that the map can be dragged. Is it possible to achieve such behaviour?
Hello Sergey,
I have been looking into your requirement and even though I managed to get a list of the Paths representing the MapElemenets there doesn’t seem to be a way to relate them to an element outside the XamMap. This is why I have submitted new product idea on your behalf, so this might appear in a future volume release of ours. I have sent your Product Idea directly to our product management team. Our product team chooses new Product Ideas for development based on popular feedback from our customer base. Infragistics continues to monitor application development for all of our products, so as trends appear in requested features, we can plan accordingly.
We value your input, and our philosophy is to enhance our toolset based on customer feedback. If your feature is chosen for development, you will be notified at that time. Your friendly ID for this Product Idea is PI13030075.
If you would like to follow up on your Product Idea at a later point, you may contact Developer Support management via email. Please include the reference number of your Product Idea in the subject and body of your email message. You can reach Developer Support management through the following email address: dsmanager@infragistics.com
Thank you for your request.
Regarding your requirement I can suggest you either use the mouse positions at the time of the click for your new window, or better yet create a value template of your liking with an actual ToolTip: http://help.infragistics.com/NetAdvantage/WPF/2012.2/CLR4.0/?page=xamWebMap_Customize_Map_with_Value_Templates.html , which would not interfere with your dragging.
Please let me know, if I can be of any further assistance on the matter.
I have been further looking into your requirement and have managed to use some internal code to achieve the functionality you wanted. Here is a sample project (XamMap_translate_from_map.zip) that shows how you can pin point a MapElement’s window location.
Please let me know, if you require any further assistance on the matter.
Thanks a lot for your help!