<?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 After setting DynamicLayerInfos layer visibilities are not obeyed properly in ArcGIS Runtime SDK for WPF (Retired) Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/after-setting-dynamiclayerinfos-layer-visibilities/m-p/58028#M274</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In the layer's Initialized event we are setting the DynamicLayerInfos and then setting the min/maxScale. This is to get around the issue that dynamic layers do not allow you to extend outside the bounds of the published scale (&lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/100223-DynamicLayerInfos-Changing-MinScale-Not-Working"&gt;http://forums.arcgis.com/threads/100223-DynamicLayerInfos-Changing-MinScale-Not-Working&lt;/A&gt;&lt;SPAN&gt;). So we have special services published with no scale and we are trying to initialize the default scales we want.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This has caused a few additional issues though. When DynamicLayerInfos is set, layer visibilities are no longer obeyed. Though the TOC does not show them checked, the layers render (might just be the group layers, cant tell easily). Toggling one item in the TOC fixes the problem though and then things render fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To get around this issue, I thought we could just set the VisibleLayers since it starts off null. Tried this one of two ways with issues:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Added the IDs for all the layers with layerInfo.DefaultVisibility == true. But this does not work where there are group layers that are disabled and the sub layers enabled. The parent group layer automatically gets checked even though its ID is not in the list.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Added the IDs for just the layers that are truly visible, so not the layers under a disabled group. But this of course does not check those sub layers in the TOC so when the outer group is enabled, the sub layers have to be enabled too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas to get around this issue and enable the default visible layers properly?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a lot!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 Jun 2014 02:43:28 GMT</pubDate>
    <dc:creator>RyanCoodey</dc:creator>
    <dc:date>2014-06-06T02:43:28Z</dc:date>
    <item>
      <title>After setting DynamicLayerInfos layer visibilities are not obeyed properly</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/after-setting-dynamiclayerinfos-layer-visibilities/m-p/58028#M274</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In the layer's Initialized event we are setting the DynamicLayerInfos and then setting the min/maxScale. This is to get around the issue that dynamic layers do not allow you to extend outside the bounds of the published scale (&lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/100223-DynamicLayerInfos-Changing-MinScale-Not-Working"&gt;http://forums.arcgis.com/threads/100223-DynamicLayerInfos-Changing-MinScale-Not-Working&lt;/A&gt;&lt;SPAN&gt;). So we have special services published with no scale and we are trying to initialize the default scales we want.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This has caused a few additional issues though. When DynamicLayerInfos is set, layer visibilities are no longer obeyed. Though the TOC does not show them checked, the layers render (might just be the group layers, cant tell easily). Toggling one item in the TOC fixes the problem though and then things render fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To get around this issue, I thought we could just set the VisibleLayers since it starts off null. Tried this one of two ways with issues:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Added the IDs for all the layers with layerInfo.DefaultVisibility == true. But this does not work where there are group layers that are disabled and the sub layers enabled. The parent group layer automatically gets checked even though its ID is not in the list.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Added the IDs for just the layers that are truly visible, so not the layers under a disabled group. But this of course does not check those sub layers in the TOC so when the outer group is enabled, the sub layers have to be enabled too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas to get around this issue and enable the default visible layers properly?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a lot!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Jun 2014 02:43:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/after-setting-dynamiclayerinfos-layer-visibilities/m-p/58028#M274</guid>
      <dc:creator>RyanCoodey</dc:creator>
      <dc:date>2014-06-06T02:43:28Z</dc:date>
    </item>
    <item>
      <title>Re: After setting DynamicLayerInfos layer visibilities are not obeyed properly</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/after-setting-dynamiclayerinfos-layer-visibilities/m-p/58029#M275</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;At first glance, you need to use &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/runtime-wpf/apiref/index.html?ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer~SetLayerVisibility.html"&gt;SetLayerVisibility&lt;/A&gt;&lt;SPAN&gt; which reflects the sublayer status in the legend.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;See also the &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/runtime-wpf/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer~GetLayerVisibility.html"&gt;GetLayerVisibility &lt;/A&gt;&lt;SPAN&gt;documentation.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jun 2014 15:04:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/after-setting-dynamiclayerinfos-layer-visibilities/m-p/58029#M275</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2014-06-11T15:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: After setting DynamicLayerInfos layer visibilities are not obeyed properly</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/after-setting-dynamiclayerinfos-layer-visibilities/m-p/58030#M276</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks a lot for the info Dominique, but maybe I am still doing something wrong. Tried setting the layer visibility using these methods a few ways:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
foreach (LayerInfo layerInfo in Layers)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SetLayerVisibility(layerInfo.ID, layerInfo.DefaultVisibility);
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
foreach (LayerInfo layerInfo in Layers)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SetLayerVisibility(layerInfo.ID, GetLayerVisibility(layerInfo.ID));
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But I still have the problem mentioned in number 1, and the disabled group layers are rendering. Am I doing something wrong? Maybe you could elaborate more on how I should be using those methods?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:12:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/after-setting-dynamiclayerinfos-layer-visibilities/m-p/58030#M276</guid>
      <dc:creator>RyanCoodey</dc:creator>
      <dc:date>2021-12-10T22:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: After setting DynamicLayerInfos layer visibilities are not obeyed properly</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/after-setting-dynamiclayerinfos-layer-visibilities/m-p/58031#M277</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Should have waited to reply earlier... got it working now.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The catch is that VisibleLayers cannot be null before using SetLayerVisibility. If it is null, SetLayerVisibility leaves it null and the problem still exists, but if it is initialized to anything, then the SetLayerVisibility loop resets it properly without the issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I just had to do:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
VisibleLayers = new[] { 0 }; //Must initialize to anything but null, will be reset below.
foreach (LayerInfo layerInfo in Layers)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SetLayerVisibility(layerInfo.ID, layerInfo.DefaultVisibility);
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks much Dominique for leading us to a fix!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:12:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-wpf-retired-questions/after-setting-dynamiclayerinfos-layer-visibilities/m-p/58031#M277</guid>
      <dc:creator>RyanCoodey</dc:creator>
      <dc:date>2021-12-10T22:12:05Z</dc:date>
    </item>
  </channel>
</rss>

