<?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: Legend - Hiding layers in the treeview in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/legend-hiding-layers-in-the-treeview/m-p/373694#M9644</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You have to hook up an handler to the legend Refreshed event and in this handler you can add/remove/change any items in the legend tree (from a layerItem, you can get the LayerItems children and so on if it's a group layer)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Dec 2010 15:34:17 GMT</pubDate>
    <dc:creator>DominiqueBroux</dc:creator>
    <dc:date>2010-12-09T15:34:17Z</dc:date>
    <item>
      <title>Legend - Hiding layers in the treeview</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/legend-hiding-layers-in-the-treeview/m-p/373693#M9643</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would like to hide specific layers in the Legend but still have them show up on the map.&amp;nbsp; I'm not talking about MapService layers which are easy to hide by not including them in the Legend.LayerIds property.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Specifically, we've got annotation sublayers that we need on the Map but are just noise on the Legend.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Within the LayerTemplate I've got a StackPanel that I'm Collapsing if it's an annotation sublayer.&amp;nbsp; However, that just leaves an empty node in the Legend TreeView.&amp;nbsp; I'm guessing I need to Collapse the TreeViewItem itself, but I can't figure out how to access it.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Dec 2010 14:36:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/legend-hiding-layers-in-the-treeview/m-p/373693#M9643</guid>
      <dc:creator>AndrewWhite</dc:creator>
      <dc:date>2010-12-09T14:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: Legend - Hiding layers in the treeview</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/legend-hiding-layers-in-the-treeview/m-p/373694#M9644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You have to hook up an handler to the legend Refreshed event and in this handler you can add/remove/change any items in the legend tree (from a layerItem, you can get the LayerItems children and so on if it's a group layer)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Dec 2010 15:34:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/legend-hiding-layers-in-the-treeview/m-p/373694#M9644</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2010-12-09T15:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: Legend - Hiding layers in the treeview</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/legend-hiding-layers-in-the-treeview/m-p/373695#M9645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;You have to hook up an handler to the legend Refreshed event and in this handler you can add/remove/change any items in the legend tree (from a layerItem, you can get the LayerItems children and so on if it's a group layer)&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wow, that seems really hacky to me.&amp;nbsp; Seems like I should have the ability to use a DataConverter to evaluate the LayerItemViewModel and set the visibility of the treeview nodes.&amp;nbsp; Just my 2c.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Dec 2010 18:53:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/legend-hiding-layers-in-the-treeview/m-p/373695#M9645</guid>
      <dc:creator>AndrewWhite</dc:creator>
      <dc:date>2010-12-09T18:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: Legend - Hiding layers in the treeview</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/legend-hiding-layers-in-the-treeview/m-p/373696#M9646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to hide some layers in legend control in my dynamic map service layer. Application has one dynamic map service layer and feature layer. Dynamic service layer has 10 layers. I want to hide some specific layers in legend control which is from dynmaic map service . How do I go about.?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I use latest SL 2.1 version and legend control. Pl help&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Dec 2010 04:31:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/legend-hiding-layers-in-the-treeview/m-p/373696#M9646</guid>
      <dc:creator>LakshmananVenkatesan</dc:creator>
      <dc:date>2010-12-14T04:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Legend - Hiding layers in the treeview</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/legend-hiding-layers-in-the-treeview/m-p/373697#M9647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can remove legend items in legendrefreshed event handler.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;There is a &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#LegendWithTemplates" rel="nofollow noopener noreferrer" target="_blank"&gt;sample &lt;/A&gt;&lt;SPAN&gt;in the InteractiveSDK.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The code looks like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; 
if (removeLayerItemVM != null)
&amp;nbsp; e.LayerItem.LayerItems.Remove(removeLayerItemVM);
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:16:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/legend-hiding-layers-in-the-treeview/m-p/373697#M9647</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2021-12-11T17:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: Legend - Hiding layers in the treeview</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/legend-hiding-layers-in-the-treeview/m-p/373698#M9648</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;When I use e.LayerItem.LayerItems.Remove(removeLayerItemVM), am changing collection at runtime and getting an error. am doing in Legend_Refreshed event as given in sample Legend with Templates.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please help me&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Dec 2010 09:48:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/legend-hiding-layers-in-the-treeview/m-p/373698#M9648</guid>
      <dc:creator>LakshmananVenkatesan</dc:creator>
      <dc:date>2010-12-14T09:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: Legend - Hiding layers in the treeview</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/legend-hiding-layers-in-the-treeview/m-p/373699#M9649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I can't guess where the issue is with so few infos.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What is your event handler code?&amp;nbsp; Which error are you getting?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Dec 2010 09:52:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/legend-hiding-layers-in-the-treeview/m-p/373699#M9649</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2010-12-14T09:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: Legend - Hiding layers in the treeview</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/legend-hiding-layers-in-the-treeview/m-p/373700#M9650</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 have sucessfully removed layers. Now, I have to change the group name to Alais name. In Legend am setting LayerID to my dynamic service layer. I want to change to alias name. How do I do that?. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &amp;lt;esri:ArcGISDynamicMapServiceLayer ID="mapLayer" InitializationFailed="FeatureLayer_InitializationFailed"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;Url="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://xxxxx/ArcGIS/rest/services/Test/MapServer" rel="nofollow" target="_blank"&gt;http://xxxxx/ArcGIS/rest/services/Test/MapServer&lt;/A&gt;&lt;SPAN&gt;" &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;legend:Legend Map="{Binding ElementName=mapControl}"&amp;nbsp;&amp;nbsp;&amp;nbsp; &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; LayerIDs= "mapLayer"&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x:Name="legendTOC"&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;In my legend, group node label appear as "mapLayer" which I need to change. Howto go about?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is that possible to remove the group layer node and only display the layers without group name?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Dec 2010 06:49:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/legend-hiding-layers-in-the-treeview/m-p/373700#M9650</guid>
      <dc:creator>LakshmananVenkatesan</dc:creator>
      <dc:date>2010-12-15T06:49:12Z</dc:date>
    </item>
    <item>
      <title>Re: Legend - Hiding layers in the treeview</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/legend-hiding-layers-in-the-treeview/m-p/373701#M9651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;On event 'Refreshed', you can also change or reorganize any legend item (as you did for removing).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A LegendItemViewModel has 3 main properties that you can change:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Label (that you can change to your alias)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - ImageSource&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Description (used in tooltip)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Concerning the removal of the group layer node, the legend control has 2 built-ins mode : "Tree" and "Flat".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;With the flat mode (LayerItemsMode="Flat"), the group layers are not shown, so it might be what you need.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For other specific cases, you need either to template the control or to change the layer tree by code in event 'Refreshed'.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Dec 2010 10:06:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/legend-hiding-layers-in-the-treeview/m-p/373701#M9651</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2010-12-15T10:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: Legend - Hiding layers in the treeview</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/legend-hiding-layers-in-the-treeview/m-p/373702#M9652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;OK. My map control has two layers 1)Dyanmic service layer and other is Featurelayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In legend, I want to change the Feature Layer name to Alais name. How do I go about ?. In refereshed event, am seeing all dynamic service layers in e.LayerItem.LayerItems not the feature layer?. When do a quick watch am not seeing any information related to featurelayer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SR&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Dec 2010 07:35:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/legend-hiding-layers-in-the-treeview/m-p/373702#M9652</guid>
      <dc:creator>LakshmananVenkatesan</dc:creator>
      <dc:date>2010-12-16T07:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: Legend - Hiding layers in the treeview</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/legend-hiding-layers-in-the-treeview/m-p/373703#M9653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Refreshed event is fired once by map layer as soon as the legend infos are available for the layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If your map contains a dynamic map service layer and a feature layer, your event handler will be called twice.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;By testing the LayerItem given by RefreshedEventArgs, you can know which layer legend you are working on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;To change a label, your code should look like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color:black;"&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.ID == &lt;SPAN style="color:#a31515;"&gt;"MyFeatureLayer"&lt;/SPAN&gt;) // could be a test on old label, layer type, url, ...
&amp;nbsp;&amp;nbsp;&amp;nbsp; e.LayerItem.Label = &lt;SPAN style="color:#a31515;"&gt;"MyAlias"&lt;/SPAN&gt;;
}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:16:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/legend-hiding-layers-in-the-treeview/m-p/373703#M9653</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2021-12-11T17:16:39Z</dc:date>
    </item>
  </channel>
</rss>

