<?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 Re: Controlling Layers in Legend Control in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760379#M19396</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Dominique,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can successfully remove a legend entry with your example above. How would I go about re-adding an item after removing it? Once I remove the LayerItem from the Legend l no longer have access to that layer to use the insert method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(HPGasLegend == false){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (layerItemVM.Layer.ID == "HP_Gas_Feeder_Layer")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Legend.LayerItems.Remove(e.LayerItem);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;else&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // here is where I would like to reinsert the layer above that I removed based on a checkbox checked/unchecked event&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // when I hover over the legend object and look through the collection I no longer see my layer that with the ID of &lt;SPAN style="font-size: 14.6666669845581px;"&gt;"HP_Gas_Feeder_Layer"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.6666669845581px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // in the collection&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 25 Nov 2014 15:49:56 GMT</pubDate>
    <dc:creator>BrandonIves</dc:creator>
    <dc:date>2014-11-25T15:49:56Z</dc:date>
    <item>
      <title>Controlling Layers in Legend Control</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760367#M19384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am testing the new Legend Control in the 2.1 API.&amp;nbsp; Is there a way to control what is shown or not shown in the Table OF Contents?&amp;nbsp; In particular, I do not want to show the Graphics Layer used to display results.&amp;nbsp; There does not seem to be any options directly on the &amp;lt;esri:GraphicsLayer&amp;gt; or the &amp;lt;esri:Legend&amp;gt; tags.&amp;nbsp; What would be nice is to have a ShowInLegend="false" attribute on the &amp;lt;esri:GraphicsLayer&amp;gt; tag.&amp;nbsp; Is there an easy way to remove the layer from the legend?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Paul&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jan 2011 12:02:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760367#M19384</guid>
      <dc:creator>PaulHuppé</dc:creator>
      <dc:date>2011-01-04T12:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Layers in Legend Control</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760368#M19385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Set the LayerIDs property of the legend control.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So for instance, you only want to display your baselayer in the legend:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;esri:Map&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;esri:ArcGISTiledMapServiceLayer ID="baseLayer" Url="..." /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/esri:Map&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;in legend:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;esri:legend Map="{Binding ElementName=MyMap}" &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LayerItemsMode="Tree" &lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;LayerIDs="baseLayer"&lt;/STRONG&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ShowOnlyVisibleLayers="True" /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To add layers to your legend, just separate them by a comma.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jan 2011 12:36:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760368#M19385</guid>
      <dc:creator>ErikEngstrom</dc:creator>
      <dc:date>2011-01-04T12:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Layers in Legend Control</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760369#M19386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That might work, but if I have lots of layers, which I do, this list of IDs can become extremely long!!!&amp;nbsp; Is there a limit to the length this string can be?&amp;nbsp; I hope there is a better way than this because it may not be manageable for us.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Paul&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jan 2011 12:48:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760369#M19386</guid>
      <dc:creator>PaulHuppé</dc:creator>
      <dc:date>2011-01-04T12:48:14Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Layers in Legend Control</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760370#M19387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Additionaly to the LayerIds property mentionned by Erike, you can dynamically remove legend items in the legend refreshed event.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For example if you don't want to see any GraphicsLayer, you can add this code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color:blue;"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color:blue;"&gt;private&lt;/SPAN&gt; &lt;SPAN style="color:blue;"&gt;void&lt;/SPAN&gt; Legend_Refreshed(&lt;SPAN style="color:blue;"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="color:#2b91af;"&gt;Legend&lt;/SPAN&gt;.&lt;SPAN style="color:#2b91af;"&gt;RefreshedEventArgs&lt;/SPAN&gt; e)
{
&lt;SPAN style="color:blue;"&gt;if&lt;/SPAN&gt; (e.LayerItem.Layer &lt;SPAN style="color:blue;"&gt;is&lt;/SPAN&gt; ESRI.ArcGIS.Client.&lt;SPAN style="color:#2b91af;"&gt;GraphicsLayer&lt;/SPAN&gt;)
&amp;nbsp;&amp;nbsp;&amp;nbsp; MyLegend.LayerItems.Remove(e.LayerItem);
}
&lt;/PRE&gt;&lt;/SPAN&gt;&lt;SPAN&gt; You can obviously extend this sample by using another criteria than the layer type : for example a custom attached property.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:17:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760370#M19387</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2021-12-12T08:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Layers in Legend Control</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760371#M19388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried using the Remove in the Legend_Refreshed method as you suggested, and that does the trick.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Paul&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Jan 2011 13:43:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760371#M19388</guid>
      <dc:creator>PaulHuppé</dc:creator>
      <dc:date>2011-01-04T13:43:08Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Layers in Legend Control</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760372#M19389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there a way to remove the Bing basemap from the Legend?&amp;nbsp; I tried using the same code as the GraphicsLayer, but it just doesn't see it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if (e.LayerItem.Layer is ESRI.ArcGIS.Client.Bing.TileLayer)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyLegend.LayerItems.Remove(e.LayerItem);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also tried:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if (layerItemVM.Layer.ID == "BingLayer")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; removeLayerItemVM = layerItemVM;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Jan 2011 23:50:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760372#M19389</guid>
      <dc:creator>karenvolarich</dc:creator>
      <dc:date>2011-01-26T23:50:00Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Layers in Legend Control</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760373#M19390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Is there a way to remove the Bing basemap from the Legend? I tried using the same code as the GraphicsLayer, but it just doesn't see it.&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You have to hookup the handler to the Refreshed event:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color:blue;"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color:blue;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color:#a31515;"&gt;esri&lt;/SPAN&gt;&lt;SPAN style="color:blue;"&gt;:&lt;/SPAN&gt;&lt;SPAN style="color:#a31515;"&gt;Legend&lt;/SPAN&gt;&lt;SPAN style="color:red;"&gt; x&lt;/SPAN&gt;&lt;SPAN style="color:blue;"&gt;:&lt;/SPAN&gt;&lt;SPAN style="color:red;"&gt;Name&lt;/SPAN&gt;&lt;SPAN style="color:blue;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color:blue;"&gt;"MyLegend"&lt;/SPAN&gt;&lt;SPAN style="color:red;"&gt; Map&lt;/SPAN&gt;&lt;SPAN style="color:blue;"&gt;="{&lt;/SPAN&gt;&lt;SPAN style="color:#a31515;"&gt;Binding&lt;/SPAN&gt;&lt;SPAN style="color:red;"&gt; ElementName&lt;/SPAN&gt;&lt;SPAN style="color:blue;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color:blue;"&gt;MyMap&lt;/SPAN&gt;&lt;SPAN style="color:blue;"&gt;}&lt;/SPAN&gt;&lt;SPAN style="color:blue;"&gt;"&lt;/SPAN&gt; &lt;SPAN style="color:red;"&gt;Height&lt;/SPAN&gt;&lt;SPAN style="color:blue;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color:blue;"&gt;"400"&lt;/SPAN&gt;&lt;SPAN style="color:red;"&gt; Width&lt;/SPAN&gt;&lt;SPAN style="color:blue;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color:blue;"&gt;"400"&lt;/SPAN&gt; 
&lt;SPAN style="font-size:4;"&gt;&lt;SPAN style="color:red;"&gt;Refreshed&lt;/SPAN&gt;&lt;SPAN style="color:blue;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color:blue;"&gt;"Legend_Refreshed"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color:blue;"&gt; &amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color:black;"&gt;Then both versions of your code should work.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:17:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760373#M19390</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2021-12-12T08:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Layers in Legend Control</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760374#M19391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I already have that in my xaml:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;esri:Legend Map="{Binding ElementName=Map}"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Name="MyLegend"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LayerItemsMode="Tree"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ShowOnlyVisibleLayers="False"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Refreshed="Legend_Refreshed"&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any other ideas?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Karen&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Jan 2011 14:37:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760374#M19391</guid>
      <dc:creator>karenvolarich</dc:creator>
      <dc:date>2011-01-27T14:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Layers in Legend Control</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760375#M19392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN style="font-family:Arial;"&gt;You are right there is an issue.The event is not fired with Bing layers (because this kind of layer doesn't return any legend).&lt;/SPAN&gt;&lt;SPAN style="font-family:Arial;"&gt;This is a bug that we'll try to fix for next version.&lt;/SPAN&gt;&lt;SPAN style="font-family:Arial;"&gt;For the moment, the workaround might be to remove the bing layers from the legend whatever the layer firing the event:&lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;private void Legend_Refreshed(object sender, Client.Toolkit.Legend.RefreshedEventArgs e)
{
 foreach (var bingLayerItem in MyLegend.LayerItems.Where(item =&amp;gt; item.Layer is TileLayer).ToList())
&amp;nbsp;&amp;nbsp; MyLegend.LayerItems.Remove(bingLayerItem);
}&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Not very elegant, but....&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:17:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760375#M19392</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2021-12-12T08:17:54Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Layers in Legend Control</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760376#M19393</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That works!&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Feb 2011 16:57:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760376#M19393</guid>
      <dc:creator>karenvolarich</dc:creator>
      <dc:date>2011-02-03T16:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Layers in Legend Control</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760377#M19394</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm going to bounce one more question out there for you...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have added the ability to dynamically add an ArcGISDynamicLayer Map Service to the map and to the TOC/Legend.&amp;nbsp; But, it places it at the bottom of the legend, and I would like to place it at the top.&amp;nbsp; There doesn't seem to be an "orderby" type method.&amp;nbsp; I was looking at LegendUpdated but am not seeing anything that might assist in the ordering of the dynamically added data.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Feb 2011 01:16:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760377#M19394</guid>
      <dc:creator>karenvolarich</dc:creator>
      <dc:date>2011-02-04T01:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Layers in Legend Control</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760378#M19395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; &lt;BR /&gt;I have added the ability to dynamically add an ArcGISDynamicLayer Map Service to the map and to the TOC/Legend. But, it places it at the bottom of the legend, and I would like to place it at the top. &lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;By default, the entries in the legend are in the same order than the layers in the map. So, if you add a layer at the bottom of the map, it will be at the bottom of the legend.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want to change this behavior, the easier way is to set the LayerIds property. The legend will be ordered as the LayerIds.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For some scenarios, it might also be useful to reorder dynamically by code on the event Legend.Refreshed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A code like this one should do the job:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: blue;"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color:#2b91af;"&gt;&lt;SPAN style="color:blue;"&gt;private&lt;/SPAN&gt; &lt;SPAN style="color:blue;"&gt;void&lt;/SPAN&gt; Legend_Refreshed(&lt;SPAN style="color:blue;"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="color:#2b91af;"&gt;Legend&lt;/SPAN&gt;.&lt;SPAN style="color:#2b91af;"&gt;RefreshedEventArgs&lt;/SPAN&gt; e)
{
&amp;nbsp; Legend&lt;/SPAN&gt; legend = sender &lt;SPAN style="color:blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color:#2b91af;"&gt;Legend&lt;/SPAN&gt;;
&lt;SPAN style="color:blue;"&gt; if&lt;/SPAN&gt; (e.LayerItem.Layer.ID == &lt;SPAN style="color:#a31515;"&gt;"MyTopLayerID"&lt;/SPAN&gt;)
&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; legend.LayerItems.Remove(e.LayerItem); &lt;SPAN style="color:green;"&gt;// Remove legend entry from its current location&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; legend.LayerItems.Insert(0, e.LayerItem); &lt;SPAN style="color:green;"&gt;//Add it at the top&lt;/SPAN&gt;
&amp;nbsp; } 
}
&lt;/PRE&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:17:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760378#M19395</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2021-12-12T08:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Layers in Legend Control</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760379#M19396</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Dominique,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can successfully remove a legend entry with your example above. How would I go about re-adding an item after removing it? Once I remove the LayerItem from the Legend l no longer have access to that layer to use the insert method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(HPGasLegend == false){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (layerItemVM.Layer.ID == "HP_Gas_Feeder_Layer")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Legend.LayerItems.Remove(e.LayerItem);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;else&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // here is where I would like to reinsert the layer above that I removed based on a checkbox checked/unchecked event&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // when I hover over the legend object and look through the collection I no longer see my layer that with the ID of &lt;SPAN style="font-size: 14.6666669845581px;"&gt;"HP_Gas_Feeder_Layer"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 14.6666669845581px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // in the collection&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Nov 2014 15:49:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760379#M19396</guid>
      <dc:creator>BrandonIves</dc:creator>
      <dc:date>2014-11-25T15:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Layers in Legend Control</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760380#M19397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The easiest way to get a layer out of the legend is to set the layer.ShowLegend property to false.&lt;/P&gt;&lt;P&gt;So by binding this layer property to your checkbox, you should directly get the expected behavior.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Else, if for any reason you'd rather using the Legend_Refreshed Handler, a couple of possible options:&lt;/P&gt;&lt;P&gt;&amp;nbsp; - call Refresh on the Legend object (the drawback is that all legend layers will be refreshed)&lt;/P&gt;&lt;P&gt;&amp;nbsp; - keep the legend item in a private field when you removed it, so you can readd it when needed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Nov 2014 16:24:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760380#M19397</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2014-11-25T16:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Layers in Legend Control</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760381#M19398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was attempting to keep a copy of the legend item and readd it but it seems like it will be overly complicated for multiple layers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you give an example of the binding the layer property to the checkbox?&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Nov 2014 20:45:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760381#M19398</guid>
      <dc:creator>BrandonIves</dc:creator>
      <dc:date>2014-11-25T20:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Layers in Legend Control</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760382#M19399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nevermind Dominique,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got it to work with this code. Thank&amp;nbsp; you for your help in pointing me in the correct direction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;CheckBox Content="CheckBox" Height="16" HorizontalAlignment="Left" Margin="331,261,0,0" VerticalAlignment="Top" &lt;/P&gt;&lt;P&gt;DataContext="{Binding Layers, ElementName=MyMap}"&lt;/P&gt;&lt;P&gt;IsChecked="{Binding [GasLayer].ShowLegend, Mode=TwoWay}"&amp;nbsp; /&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Nov 2014 21:34:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/controlling-layers-in-legend-control/m-p/760382#M19399</guid>
      <dc:creator>BrandonIves</dc:creator>
      <dc:date>2014-11-25T21:34:34Z</dc:date>
    </item>
  </channel>
</rss>

