<?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: Dynamically Remove Layer in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/dynamically-remove-layer/m-p/144326#M3594</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Perfect - Exactly what I was looking for.&amp;nbsp; Thanks so much!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 May 2010 17:02:21 GMT</pubDate>
    <dc:creator>MikeTischler</dc:creator>
    <dc:date>2010-05-18T17:02:21Z</dc:date>
    <item>
      <title>Dynamically Remove Layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/dynamically-remove-layer/m-p/144322#M3590</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've followed the API Example for adding a layer dynamically....but how do I remove one dynamically?&amp;nbsp; I see plenty of examples for toggling visibility, but how do I actually remove it from the map?&amp;nbsp; I'm buidling a table of contents that dynamically updates when a new layer is added.&amp;nbsp; However, I can't figure out how to remove a layer if it's no longer necessary.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 May 2010 19:10:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/dynamically-remove-layer/m-p/144322#M3590</guid>
      <dc:creator>MikeTischler</dc:creator>
      <dc:date>2010-05-14T19:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Remove Layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/dynamically-remove-layer/m-p/144323#M3591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Remove the layer from the layer collection associated to the map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;myMap.Layers.Remove(myLayer);&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 May 2010 09:50:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/dynamically-remove-layer/m-p/144323#M3591</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2010-05-15T09:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Remove Layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/dynamically-remove-layer/m-p/144324#M3592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;which seems easy enough...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but, if you add in 3 layers dynamically (following the example), how do you link them back to a MyLayer object in XAML?&amp;nbsp; How can you get a layer index?&amp;nbsp; How can you query a layer name?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a way to do the layer removal through XAML, or must it be a function in C#/VB?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To be a bit clearer (my original post was pretty vague, I'll admit).&amp;nbsp; I'm attempting to add a list of objects to a silverlight front end much like the example at &lt;/SPAN&gt;&lt;A href="http://resources.esri.com/help/9.3/arcgisserver/apis/silverlight/samples/start.htm#LayerList"&gt;http://resources.esri.com/help/9.3/arcgisserver/apis/silverlight/samples/start.htm#LayerList&lt;/A&gt;&lt;SPAN&gt;.&amp;nbsp; This would be done dynamically...you can put in a URL for a service and a new checkbox/slider would appear for that layer underneath the already existing ones.&amp;nbsp; BUT, I would also like to add a "close" button to the individual stack panels that would 1) Remove the layer from the map entirely and 2) remove the slider/checkbox/button .&amp;nbsp;&amp;nbsp; I'm having a hard time figuring out how to reference a layer to remove it from the map, if it's added dynamically, and through a control that uses binding such as in the example.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks very much for the help!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 May 2010 15:29:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/dynamically-remove-layer/m-p/144324#M3592</guid>
      <dc:creator>MikeTischler</dc:creator>
      <dc:date>2010-05-18T15:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Remove Layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/dynamically-remove-layer/m-p/144325#M3593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In the example, the datacontext of each item is the layer itself (it's why we can display the name, change the opacity....).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So if you add a 'Delete' button, you have to write a code like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;private void ButtonDelete_Click(object sender, System.Windows.RoutedEventArgs e)
{
 FrameworkElement element = sender as FrameworkElement;
 this.MyMap.Layers.Remove(element.DataContext as Layer);
}&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;The layer will be removed from the map and the button/checkbox/slider will be removed automatically as well (thanks to the SL/WPF binding).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Concerning your question about the layer removal through XAML, I don't think you can do that out of the box.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:54:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/dynamically-remove-layer/m-p/144325#M3593</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2021-12-11T07:54:32Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Remove Layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/dynamically-remove-layer/m-p/144326#M3594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Perfect - Exactly what I was looking for.&amp;nbsp; Thanks so much!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 May 2010 17:02:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/dynamically-remove-layer/m-p/144326#M3594</guid>
      <dc:creator>MikeTischler</dc:creator>
      <dc:date>2010-05-18T17:02:21Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Remove Layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/dynamically-remove-layer/m-p/144327#M3595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;or simply: myMap.Layers.RemoveAt(index)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 May 2010 18:53:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/dynamically-remove-layer/m-p/144327#M3595</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2010-05-19T18:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Remove Layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/dynamically-remove-layer/m-p/144328#M3596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;But how to get a Layer object if it is in a grouplayer?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Sep 2011 18:28:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/dynamically-remove-layer/m-p/144328#M3596</guid>
      <dc:creator>EzequiasRodrigues_da_Rocha</dc:creator>
      <dc:date>2011-09-08T18:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Remove Layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/dynamically-remove-layer/m-p/144329#M3597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;New to v2.3 and v3.0 is GroupLayer. I'm not sure if we are talking about the same layer type here. If yes, to remove a child layer of GroupLayer, you would do:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var groupLayer = MyMap.Layers["MyGroupLayer"] as GroupLayer;
groupLayer.ChildLayers.RemoveAt(index);
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:54:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/dynamically-remove-layer/m-p/144329#M3597</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2021-12-11T07:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Remove Layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/dynamically-remove-layer/m-p/144330#M3598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am using agslib2.3 and I didn't find out this class GroupLayer. Could you paste the namespace for me please Jennifer?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Sep 2011 23:49:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/dynamically-remove-layer/m-p/144330#M3598</guid>
      <dc:creator>EzequiasRodrigues_da_Rocha</dc:creator>
      <dc:date>2011-09-08T23:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Remove Layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/dynamically-remove-layer/m-p/144331#M3599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Are you using ArcGIS API for Silverlight? The current version is 2.2. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We are currently working on 2.3. But a 3.0 Beta 1 can be downloaded through ESRI Beta Community with ArcGIS Server 10.1 Beta 1. Both v2.3 and 3.0 versions include GroupLayer. &lt;/SPAN&gt;&lt;A _jive_internal="true" href="https://community.esri.com/beta.esri.com/community"&gt;beta.esri.com/community/&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Sep 2011 18:42:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/dynamically-remove-layer/m-p/144331#M3599</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2011-09-13T18:42:47Z</dc:date>
    </item>
  </channel>
</rss>

