<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Display Legend details for added layers using API in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/display-legend-details-for-added-layers-using-api/m-p/469175#M12118</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there a feature in API for displaying the legend details of the layers added to the map?I already tried the legend class, the problem I am facing is that the layer name is being displayed as GUID and not Layer name.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Nov 2011 06:16:30 GMT</pubDate>
    <dc:creator>ankitabhatia1</dc:creator>
    <dc:date>2011-11-08T06:16:30Z</dc:date>
    <item>
      <title>Display Legend details for added layers using API</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/display-legend-details-for-added-layers-using-api/m-p/469175#M12118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there a feature in API for displaying the legend details of the layers added to the map?I already tried the legend class, the problem I am facing is that the layer name is being displayed as GUID and not Layer name.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Nov 2011 06:16:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/display-legend-details-for-added-layers-using-api/m-p/469175#M12118</guid>
      <dc:creator>ankitabhatia1</dc:creator>
      <dc:date>2011-11-08T06:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: Display Legend details for added layers using API</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/display-legend-details-for-added-layers-using-api/m-p/469176#M12119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;By default the legend control displays the layer ID as name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So if you add layers to the map by code, the easiest way is to give a significant ID.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Else, if you have no way to change the ID, you can hook up an handler to the Legend.Refreshed event and change the label in this handler.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&lt;SPAN style="color: blue; font-family: Consolas;"&gt;&lt;SPAN style="color: black; font-family: Courier New;"&gt;&lt;SPAN style="color: blue; font-family: Consolas;"&gt;private&lt;/SPAN&gt;&lt;SPAN style="font-family:Consolas;"&gt; &lt;SPAN style="color:blue;"&gt;void&lt;/SPAN&gt; MyLegend_Refreshed(&lt;SPAN style="color:blue;"&gt;object&lt;/SPAN&gt; sender, Client.Toolkit.&lt;SPAN style="color:#2b91af;"&gt;Legend&lt;/SPAN&gt;.&lt;SPAN style="color:#2b91af;"&gt;RefreshedEventArgs&lt;/SPAN&gt; e)&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="color: black; font-family: Courier New;"&gt;{&lt;/SPAN&gt;
&lt;SPAN style="color: black; font-family: Courier New;"&gt;&lt;SPAN style="color:blue;"&gt;var&lt;/SPAN&gt; layerItem = e.LayerItem;&lt;/SPAN&gt;
 
&lt;SPAN style="color: black; font-family: Courier New;"&gt;&lt;SPAN style="color:blue;"&gt;if&lt;/SPAN&gt; (layerItem.Layer &lt;SPAN style="color:blue;"&gt;is&lt;/SPAN&gt; &lt;SPAN style="color:#2b91af;"&gt;ArcGISDynamicMapServiceLayer&lt;/SPAN&gt;)&lt;/SPAN&gt;
&lt;SPAN style="color: black; font-family: Courier New;"&gt;&amp;nbsp; layerItem.Label = ((&lt;SPAN style="color:#2b91af;"&gt;ArcGISDynamicMapServiceLayer&lt;/SPAN&gt;)layerItem.Layer).MapName;&lt;/SPAN&gt;
&lt;SPAN style="font-family:Courier New;"&gt;else if &lt;SPAN style="color:#000000;"&gt;(layerItem.Layer &lt;/SPAN&gt;&lt;SPAN style="color:blue;"&gt;is&lt;/SPAN&gt;&lt;SPAN style="color:#2b91af;"&gt; .......&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN style="color: black; font-family: Consolas;"&gt;}&lt;/SPAN&gt;
&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:47:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/display-legend-details-for-added-layers-using-api/m-p/469176#M12119</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2021-12-11T20:47:55Z</dc:date>
    </item>
  </channel>
</rss>

