Select to view content in your preferred language

Catching Click and Doubleclick events from Feature Layers

4352
3
08-28-2011 02:22 AM
Labels (1)
AvnerKashtan
Emerging Contributor
Good morning.

Is there an established, well-tested way to capture double-click events on Feature Layers on an esri:Map instance? The FeatureLayer object exposes ButtonDown and ButtonUp events, but no Click event, and certainly no DoubleClick. Is there a better way to handle click events other than catching both MouseDown and MouseUp events and making sure the pointer didn't move much, and a better way of handling doubleclicks than keeping a click counter?

Thanks,
   Avner
0 Kudos
3 Replies
JenniferNery
Esri Regular Contributor
There is GraphicsLayer/FeatureLayer.MouseLeftButtonDown and Map.MouseClick.

You can see these events used in the following samples:
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#CustomSymbols
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#InfoWindowSimple
0 Kudos
AvnerKashtan
Emerging Contributor
There is GraphicsLayer/FeatureLayer.MouseLeftButtonDown and Map.MouseClick.


So the FeatureLayer gives me only MouseDown events. The Map can give me a Click, but then I have to manually check the feature layers to see which one was clicked. And neither give me a DoubleClick event, since the Map's DoubleClick is a generic WPF event, not an ESRI event, so I don't get the MapPoint's real location, and so I have to massage these different events together to get the functionality I want, which is a shame.

It'd be great if this functionality was added to newer versions of the API.

Thanks,
   Avner
0 Kudos
JenniferNery
Esri Regular Contributor
You're right, WPF Control includes MouseDoubleClick event: http://msdn.microsoft.com/en-us/library/system.windows.controls.control.mousedoubleclick.aspx

Map (also a Control) will inherit this event. You can then transform the screen point to map point and/or use FindHostInGraphicsCoordinates() to get Graphics under the mouse event.
0 Kudos