Select to view content in your preferred language

Code Samples

1146
6
07-21-2010 11:49 AM
CraigPerreault
Deactivated User
When a user clicks on a graphic in this sample, how do I know what they clicked on?  I was trying the MouseLeftButtonDown event?

http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#SDSMap
0 Kudos
6 Replies
dotMorten_esri
Esri Notable Contributor
The graphic they clicked on is in the event argument (e.Graphic). Note that if you click on a cluster, you get the cluster that represents the clustered graphics. This is by design.
0 Kudos
CraigPerreault
Deactivated User
If they click on a node of a cluster can you get the attributes?
0 Kudos
JenniferNery
Esri Regular Contributor
If you add a MouseLeftButtonDown event on the GraphicsLayer with clusterer, e.Graphic is your node that represents the cluster and you can view its attributes (Count, Size, Color).

Jennifer
0 Kudos
CraigPerreault
Deactivated User
Is there a way to get the FID(s) of the features in the cluster?
0 Kudos
JenniferNery
Esri Regular Contributor
Sure, in the same MouseLeftButtonDown event handler, you can do the following:

GraphicsLayer l = sender as GraphicsLayer;
IEnumerable<Graphic> graphics = l.FindGraphicsInHostCoordinates(e.GetPosition(null));

This gives you an enumerable of graphics contained in that cluster.

Jennifer
0 Kudos
CraigPerreault
Deactivated User
Brilliant! Thanks!!!
I can loop through the graphics and see the values but can I determine which one was clicked?
0 Kudos