private void QueryPoint_MouseClick(object sender, ESRI.ArcGIS.Client.Map.MouseEventArgs e)
{
ESRI.ArcGIS.Client.Geometry.MapPoint clickPoint = e.MapPoint;
ESRI.ArcGIS.Client.Tasks.IdentifyParameters identifyParams = new IdentifyParameters()
{
Geometry = clickPoint,
MapExtent = MyMap.Extent,
Width = (int)MyMap.ActualWidth,
Height = (int)MyMap.ActualHeight,
LayerOption = LayerOption.visible,
SpatialReference = MyMap.SpatialReference
};
IdentifyTask identifyTask = new IdentifyTask("http://gismaps.pagnet.org/arcgis/rest/services/Interactive_TIP_2011/MapServer");
identifyTask.ExecuteCompleted += IdentifyTask_ExecuteCompleted;
identifyTask.ExecuteAsync(identifyParams);
GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
graphicsLayer.ClearGraphics();
ESRI.ArcGIS.Client.Graphic graphic = new ESRI.ArcGIS.Client.Graphic()
{
Geometry = clickPoint,
Symbol = LayoutRoot.Resources["DefaultPictureSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol
};
graphicsLayer.Graphics.Add(graphic);
}You can refer to this link for IdentifyParameters http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Tasks.Iden...
You can set LayerIds property.
identifyParams.LayerIds.AddRange(new int[] { 1, 2 });
//identifyParameters.LayerIds = new System.Collections.Generic.List<int>(); <-- cannot change instance
identifyParameters.LayerIds.AddRange(new int[] { 1, 2 }); // can change collection
private void QueryPoint_MouseClick(object sender, ESRI.ArcGIS.Client.Map.MouseEventArgs e)
{
ESRI.ArcGIS.Client.Geometry.MapPoint clickPoint = e.MapPoint;
List<int> LayerList = new List<int>();
LayerList.Add(0);
LayerList.Add(1);
LayerList.Add(2);
LayerList.Add(3);
ESRI.ArcGIS.Client.Tasks.IdentifyParameters identifyParams = new IdentifyParameters()
{
Geometry = clickPoint,
MapExtent = MyMap.Extent,
Width = (int)MyMap.ActualWidth,
Height = (int)MyMap.ActualHeight,
LayerOption = LayerOption.top,
SpatialReference = MyMap.SpatialReference
};
identifyParams.LayerIds.AddRange(new int[] { 4,5 }); // These are the layers you want included.
IdentifyTask identifyTask = new IdentifyTask("http://gismaps.pagnet.org/arcgis/rest/services/ARRA_042211_plot/MapServer");
identifyTask.ExecuteCompleted += IdentifyTask_ExecuteCompleted;
identifyTask.ExecuteAsync(identifyParams);
GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
graphicsLayer.ClearGraphics();
ESRI.ArcGIS.Client.Graphic graphic = new ESRI.ArcGIS.Client.Graphic()
{
Geometry = clickPoint,
Symbol = LayoutRoot.Resources["DefaultPictureSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol
};
graphicsLayer.Graphics.Add(graphic);
}