I'd like to detect what map element is beneath arbitrary screen coordinates (other than the mouse coordinates) on a XamMap.
My XamMap/MapLayer is loaded from the usa map shapefile. There is good support for which MapElement/SurfaceElement is clicked via the ElementClick event, but haven't been able to find the same mapping for an arbitrary screen point.
Thanks for any help.
Hello Greg,
I have been reading through your description and the fact of the matter is I also thought of that while trying to resolve onlyrock’s request. 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 PI12080019.
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.
Hi Petar,
Thanks for the response. I think the main issue is that the XamMap control's WPF elements (like SurfaceElement and MapElement) don't have their DataContext set to the data item which they are representing. For example, with the UsaMap example, the WPF elements for for "Texas" will have their data context set to my main window's data context, not the data item which represents "Texas".
WPF provides the mechanism to get the set of visuals underneath an arbitrary point, so if the the data context is set properly on the visuals then I can distinguish which data item is being represented by the visuals.
More details: I'm using data binding for my "MapLayer" much like in the example code. My MapLayer is bound using 'DataSource="{Binding Path=UsaMapViewModel.StateInfos}"' so I would expect each state to have its DataContext set to "StateInfo". Instead, it's set to the outermost data context, which in my case is a class called "AppViewModel".
Note that I'm also using XamPieChart, and it appears to do the data binding correctly. My pie chart is bound using 'ItemsSource="{Binding Path=Slices}"'. When I get the DataContext for the visuals which represent a slice on screen, the value is (correctly) my "Slice" class.
Thanks,
Greg
Hello,
I have been looking into your enquiry and there indeed is no such built-in functionality in the XamMap for that. If you’d like, I can submit a Feature Request on your behalf, so that may appear in a future volume release of ours. If so please explain in more details what exactly would you expect the functionality to be.
Looking forward to hearing from you.