I have a print service setup with custom layouts published with Export Web Map. The Layouts do not contain any layers, these are added in the PrintTask . I have created a dictionary of all of the layers that are within my map extent named legendInfo.
For the legend I need to set the SublayerIds for the Legend Layer to be those that are within the map extent and are visible. This is done to minimize the size of the Legend on the pdf.
For the dictionary key value pair, the key is the ID of the ArcGISDynamicMapServiceLayer and the values are a List<int> of the subids for the ArcGISDynamicMapServiceLayer.
. I have tried several casts such as pair.Value as IEnumerable<List<int>>.
SublayerIds are null after the loop has finished.
Scratching my head...any suggestions? Thanks in advance...
Margo
foreach (var pair in legendInfo)
{
ESRI.ArcGIS.Client.Printing.LegendLayer myLegendLayer = new ESRI.ArcGIS.Client.Printing.LegendLayer();
// Set the LegendLayer.LayerId to the Layer.ID to add it to the printed map's legend area.
myLegendLayer.LayerId = pair.Key.ToString();
myLegendLayer.SubLayerIds = pair.Value as IEnumerable<Object>;
myLegendLayers.Add(myLegendLayer);
}