.NET Graphics Layer Legend Problem with Print Service

647
0
11-28-2017 01:30 PM
HenryAtWork
New Contributor

Hi,

We have custom print/export map services that uses custom MXD print templates. The templates have the standard "Legend" component (ArcMap -> Insert -> Legend). We have a .NET SDK that have multiple graphics layers. When I print/export with the map services, the Legend area shows some random ID/GUID each time for the graphics layers everytime I print. How can I remove these random long IDs, and show the proper graphics layer display name / ID instead?

I have tried to set the graphic layers' IDs and DisplayName properties but this did not work (in fact, I get different IDs each time I print with the same graphics layers, so problem isn't with the graphic layers' IDs or DisplayName properties).

This is code snippet for creating graphics layers:

private void AddDefaultGraphicsLayer(String ID)
{
  var graphicsLayer = new GraphicsLayer();
  graphicsLayer.ID = ID;
  graphicsLayer.DisplayName = ID;
  //graphicsLayer.ShowLegend = false;
  MyMap.Layers.Add(graphicsLayer);
}

I think it is something to do with legend (because if I set ShowLegend to true, the random ID shows; if I set it false, random ID disppears). 

I am using ArcGIS .NET SDK 10.2.7 with ArcGIS for Desktop (to create print templates) and Server (print services) with version 10.5.

0 Kudos
0 Replies