Select to view content in your preferred language

How to get the clicked graphic(or a feature) in a graphicslayer(or a featurelayer) using runtime sdk for .ne

3947
2
05-13-2015 09:19 AM
JohnWoon
Deactivated User

I would like to obtain informations(the instance) of the clicked feature in a feature layer.

In runtime for wpf we have the MouseLeftButtonDown event provided by the graphicslayer class. The event will pass the clicked instance, but not a equivalent one could be found in runtime for .net.

0 Kudos
2 Replies
AnttiKajanus1
Deactivated User

You can use MapViewTapped event (or Editor class) to get location and then use Layer's HitTestAsync method to get graphics from the layer.

See sample HitTesting​ or equivalent for GraphicsLayers / Overlays.

0 Kudos
JohnWoon
Deactivated User

HitTesting only returns an array of the feature ids, not graphics. And I am not quite sure, but it seems "var features = await cities.FeatureTable.QueryAsync(rows);"  may re-query the server.

I tried a similarly way before, and I found that I could retrieve more attributes than the outfields I defined before.

I there a possible way to query locally cached data? So it may speed up.

0 Kudos