Programmatically Click Map

494
1
03-08-2011 05:51 AM
WilliamKimrey
New Contributor II
Hello all,

Just a quick question wondering whether it's possible or not to invoke a Map Click programmatically.  If this is possible, can I set a specific coordinate to click on the map, or perhaps where the map is currently centered?

What I'm trying to do is allow a user to add a feature using the Editor tool by setting XY coordinates instead of clicking on the map.  I think this will be the easiest way, but if I'm missing something please let me know.

Thanks,
Will
0 Kudos
1 Reply
JenniferNery
Esri Regular Contributor
I think your best option for adding a graphic to your map given the X,Y coordinates is by setting Graphic.Geometry property. See this sample: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#AddGraphics
 MapPoint mapPoint = new MapPoint(X, Y);
 graphicsLayer.Graphics.Add(new Graphic() { Geometry =  mapPoint});
 MyMap.ZoomToResolution(MyMap.Resolution*.5, mapPoint);


You may not be able to use Editor.Add for this purpose: http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Editor~Add.... Add CommandParameter does not take the geometry, instead you need to pass either symbol or feature type.
0 Kudos