<?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: Getting error while adding child layer to GroupLayer in code behind. in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/getting-error-while-adding-child-layer-to/m-p/175343#M4369</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It worked. Thanks for the help Domnique, appreciate it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My thought is this should be mentioned in class documentation for GroupLayer, otherwise it is very confusing. Because adding a layer to the map and to the GroupLayer are two different things in my opinion.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 10 Dec 2011 14:40:29 GMT</pubDate>
    <dc:creator>SanajyJadhav</dc:creator>
    <dc:date>2011-12-10T14:40:29Z</dc:date>
    <item>
      <title>Getting error while adding child layer to GroupLayer in code behind.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/getting-error-while-adding-child-layer-to/m-p/175340#M4366</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 am adding the child layer to the Group layer in the code behind (adding them in XAML is not feasible for me)and getting the exception "&lt;/SPAN&gt;&lt;STRONG&gt;Value does not fall within the expected range&lt;/STRONG&gt;&lt;SPAN&gt;".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My code is as below.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;

//create new group layer &amp;amp; set ID
GroupLayer siteIntentGrLyr = new GroupLayer();
siteIntentGrLyr.ID = "Site Intent Group Layer";

//access indidual feature layers from the collection &amp;amp; add them to the siteIntentGrLyr
Layer plantFeatLyr = featLyrList.FirstOrDefault(x =&amp;gt; x.LayerInfo.Name == "Plant");
Layer otherFeatPointFeatLyr = featLyrList.FirstOrDefault(x =&amp;gt; x.LayerInfo.Name == "Other_Features_Point");
Layer Other_Feature_LineFeatLyr = featLyrList.FirstOrDefault(x =&amp;gt; x.LayerInfo.Name == "Other_Features_Line");
Layer Other_Feature_BoundaryFeatLyr = featLyrList.FirstOrDefault(x =&amp;gt; x.LayerInfo.Name == "Other_Feature_Boundary");

//add child feature layers to the group layer
siteIntentGrLyr.ChildLayers.Add(plantFeatLyr); //on this very first line, I get error.
siteIntentGrLyr.ChildLayers.Add(otherFeatPointFeatLyr);
siteIntentGrLyr.ChildLayers.Add(Other_Feature_LineFeatLyr);
siteIntentGrLyr.ChildLayers.Add(Other_Feature_BoundaryFeatLyr); 
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would appreciate any help on this issue.Thanks in advance.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Dec 2011 11:15:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/getting-error-while-adding-child-layer-to/m-p/175340#M4366</guid>
      <dc:creator>SanajyJadhav</dc:creator>
      <dc:date>2011-12-05T11:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: Getting error while adding child layer to GroupLayer in code behind.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/getting-error-while-adding-child-layer-to/m-p/175341#M4367</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; &lt;BR /&gt;I am adding the child layer to the Group layer in the code behind (adding them in XAML is not feasible for me)and getting the exception "&lt;STRONG&gt;Value does not fall within the expected range&lt;/STRONG&gt;".&lt;BR /&gt;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You might get this error when adding twice the same layer in the map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If your feature layer is already in the map, you have to remove it before adding it in the group layer : i.e MyMap.Layers.Remove(plantFeatLyr);&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Dec 2011 09:22:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/getting-error-while-adding-child-layer-to/m-p/175341#M4367</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2011-12-06T09:22:25Z</dc:date>
    </item>
    <item>
      <title>Re: Getting error while adding child layer to GroupLayer in code behind.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/getting-error-while-adding-child-layer-to/m-p/175342#M4368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Dominique for the reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am not sure but I might be adding the layer twice as you mentioned.I would look into it and and give a try.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks once again.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Dec 2011 16:23:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/getting-error-while-adding-child-layer-to/m-p/175342#M4368</guid>
      <dc:creator>SanajyJadhav</dc:creator>
      <dc:date>2011-12-06T16:23:39Z</dc:date>
    </item>
    <item>
      <title>Re: Getting error while adding child layer to GroupLayer in code behind.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/getting-error-while-adding-child-layer-to/m-p/175343#M4369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It worked. Thanks for the help Domnique, appreciate it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My thought is this should be mentioned in class documentation for GroupLayer, otherwise it is very confusing. Because adding a layer to the map and to the GroupLayer are two different things in my opinion.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Dec 2011 14:40:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/getting-error-while-adding-child-layer-to/m-p/175343#M4369</guid>
      <dc:creator>SanajyJadhav</dc:creator>
      <dc:date>2011-12-10T14:40:29Z</dc:date>
    </item>
  </channel>
</rss>

