Select to view content in your preferred language

How to select the sub-layers in a ArcGISDynamicMapServiceLayer for Legend to display?

577
1
04-20-2011 02:31 PM
SuiHuang
Frequent Contributor
Hi Everybody:

    I am developing a silverlight application with a Map and a Legend. The map has a ArcGISDynamicMapServiceLayer with many sub-layers, and I want the Legend to display only part of these sub-layers.
    I haven't found how to do that. I tried the LayerIDs property of the Legend control, but I could not make it work for the sub-layers.
    How can I make it work?
    Thank you.

My development environment:
-- .NET 4
-- C# and Visual Studio 2010
-- Silverlight 4
-- ESRI ArcGIS API for Microsoft Silverlight/WPF
-- ArcGIS server 10.01 map services
0 Kudos
1 Reply
DominiqueBroux
Esri Frequent Contributor
I want the Legend to display only part of these sub-layers.


To do that, you have to write some code..

Hook up an handler to the event 'Legend.Refreshed'.
In this handler, remove the sublayers you don't want to see in the legend.

This legend with template sample is working this way to remove the "states" item.
0 Kudos