<?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: Map.Layers.CollectionChanged event wont fire on layer removal in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/map-layers-collectionchanged-event-wont-fire-on/m-p/54185#M1403</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It might happen that the layers collection changes after you hook up your handler.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In this case you can suscribe to PropertyChanged event of the map, and hook up your handler if the "Layers" property changed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure it's your case though, not my 2cts.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Mar 2012 07:58:43 GMT</pubDate>
    <dc:creator>DominiqueBroux</dc:creator>
    <dc:date>2012-03-27T07:58:43Z</dc:date>
    <item>
      <title>Map.Layers.CollectionChanged event wont fire on layer removal</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/map-layers-collectionchanged-event-wont-fire-on/m-p/54182#M1400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The Map.Layers.CollectionChanged event&amp;nbsp; is firing just fine when layers are added to the Map, but not when they are removed. It should. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Has anyone else seen this behaviour (or lack of it)?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Mar 2012 19:08:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/map-layers-collectionchanged-event-wont-fire-on/m-p/54182#M1400</guid>
      <dc:creator>JudyOgg</dc:creator>
      <dc:date>2012-03-23T19:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: Map.Layers.CollectionChanged event wont fire on layer removal</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/map-layers-collectionchanged-event-wont-fire-on/m-p/54183#M1401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What version of the API are you using? I could not reproduce with the following code. I have a button click to remove layer from my map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyMap.Layers.CollectionChanged += (a, b) =&amp;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; {
//breakpoint here
&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; private void Button_Click(object sender, RoutedEventArgs e)
&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; MyMap.Layers.RemoveAt(MyMap.Layers.Count -1);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:04:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/map-layers-collectionchanged-event-wont-fire-on/m-p/54183#M1401</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2021-12-10T22:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: Map.Layers.CollectionChanged event wont fire on layer removal</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/map-layers-collectionchanged-event-wont-fire-on/m-p/54184#M1402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm using version 2.4 of the API, 1.0 of the Viewer, 2.4 of the Extensibility SDK.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the ctor of my class:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;map.Layers.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Layers_CollectionChanged);&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The handler:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;void Layers_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
&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; //some code here&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; }&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:04:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/map-layers-collectionchanged-event-wont-fire-on/m-p/54184#M1402</guid>
      <dc:creator>JudyOgg</dc:creator>
      <dc:date>2021-12-10T22:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: Map.Layers.CollectionChanged event wont fire on layer removal</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/map-layers-collectionchanged-event-wont-fire-on/m-p/54185#M1403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It might happen that the layers collection changes after you hook up your handler.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In this case you can suscribe to PropertyChanged event of the map, and hook up your handler if the "Layers" property changed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure it's your case though, not my 2cts.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 07:58:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/map-layers-collectionchanged-event-wont-fire-on/m-p/54185#M1403</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2012-03-27T07:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: Map.Layers.CollectionChanged event wont fire on layer removal</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/map-layers-collectionchanged-event-wont-fire-on/m-p/54186#M1404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks! What I ended up hooking up to was the PropertyChanged event of the layers themselves, once I realized that the layers werent always being removed, were just having their visibility set to false.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 11:10:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/map-layers-collectionchanged-event-wont-fire-on/m-p/54186#M1404</guid>
      <dc:creator>JudyOgg</dc:creator>
      <dc:date>2012-03-27T11:10:17Z</dc:date>
    </item>
  </channel>
</rss>

