Select to view content in your preferred language

Legend Control with only MapTemplate and No sub Layers visible

861
2
05-13-2013 02:37 PM
RajaSrinivasan1
New Contributor
How can I use layertemplates to display only the Legend.MapLayerTemplate with the legend control and skip generating the Legend.LayerTemplate and Legend.LegendItemTemplate.
0 Kudos
2 Replies
DominiqueBroux
Esri Frequent Contributor
If you don't want to see the swatches, you can set LegendItemTemplate to null. In this case only layers and sublayers will show up in the legend (example here).

If you want to see the sublayers only, you can retemplate the legend control in order to use a listbox instead of a treeview (sample)

If you want to see the main layers only, you could also retemplate the legend control with a list box (but in this case the legend has few added value, you could as well use a listbox binded to Map.layers).
0 Kudos
RajaSrinivasan1
New Contributor
Dominique

Thanks for the suggestion. I had tried setting both LegendItemTemplate  and LayerTemplate to null and had unexpected results.
I am trying to do this only for tiled layers within the legend and so, I am afraid it's going to make it look different from others.
I will go ahead and try the listbox option.

Thanks
0 Kudos