<?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 DynamicMapServiceLayer added through code not recognized by button. in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/dynamicmapservicelayer-added-through-code-not/m-p/400802#M4770</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please bear with the low level this question is probably at. I am new to the Runtime and wpf xaml.&amp;nbsp; I&lt;BR /&gt;believe my question is more wpf/xaml based one. I hope my description that follows is clear enough. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have developed a prototype app attempting to emulate the mvvm pattern.&amp;nbsp; Between looking at the&lt;BR /&gt;toolkit samples and the regular runtime samples, I have implemented a 'toggle visible layer' method in my MapViewModel.cs that is successfully bound to a button on my MainWindow.xaml.&amp;nbsp; This button is handling a feature layer that I add to the application through app.xaml.&amp;nbsp; This is working well. I am able to toggle the layer's visibility through the button.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to add another button to handle another layer and leverage the same toggle visible method. I have added the button in MainWindow.xaml and set up the same binding parameters, except of course using the correct layer name. However, the additional layer that I wish to ‘toggle’ is added through code in the MapViewModel as a DynamicMapService Layer from a map package.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The layer I am interested in is successfully added to the map&amp;nbsp; However, the button that I have added to toggle the visibility for this layer is never enabled. I incorrectly assumed that this button would come to life when the layer is added to the map.&amp;nbsp; No such luck.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to associate a control with command method using a layer that is added through code as the parameter? &lt;/P&gt;&lt;P&gt;What would be the correct approach to handling this situation?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any insight would be appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 25 Nov 2014 22:22:22 GMT</pubDate>
    <dc:creator>ThomasCox</dc:creator>
    <dc:date>2014-11-25T22:22:22Z</dc:date>
    <item>
      <title>DynamicMapServiceLayer added through code not recognized by button.</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/dynamicmapservicelayer-added-through-code-not/m-p/400802#M4770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please bear with the low level this question is probably at. I am new to the Runtime and wpf xaml.&amp;nbsp; I&lt;BR /&gt;believe my question is more wpf/xaml based one. I hope my description that follows is clear enough. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have developed a prototype app attempting to emulate the mvvm pattern.&amp;nbsp; Between looking at the&lt;BR /&gt;toolkit samples and the regular runtime samples, I have implemented a 'toggle visible layer' method in my MapViewModel.cs that is successfully bound to a button on my MainWindow.xaml.&amp;nbsp; This button is handling a feature layer that I add to the application through app.xaml.&amp;nbsp; This is working well. I am able to toggle the layer's visibility through the button.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to add another button to handle another layer and leverage the same toggle visible method. I have added the button in MainWindow.xaml and set up the same binding parameters, except of course using the correct layer name. However, the additional layer that I wish to ‘toggle’ is added through code in the MapViewModel as a DynamicMapService Layer from a map package.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The layer I am interested in is successfully added to the map&amp;nbsp; However, the button that I have added to toggle the visibility for this layer is never enabled. I incorrectly assumed that this button would come to life when the layer is added to the map.&amp;nbsp; No such luck.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to associate a control with command method using a layer that is added through code as the parameter? &lt;/P&gt;&lt;P&gt;What would be the correct approach to handling this situation?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any insight would be appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Nov 2014 22:22:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/dynamicmapservicelayer-added-through-code-not/m-p/400802#M4770</guid>
      <dc:creator>ThomasCox</dc:creator>
      <dc:date>2014-11-25T22:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: DynamicMapServiceLayer added through code not recognized by button.</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/dynamicmapservicelayer-added-through-code-not/m-p/400803#M4771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The availability of a button is depending on the way you implemented the underlying action.&lt;/P&gt;&lt;P&gt;If you affected a command to the button, the avaibility is defined by the CanExecute method of the command, so really depending on how you implemented it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suggest you look at the &lt;A href="https://github.com/Esri/arcgis-runtime-samples-dotnet/blob/master/src/Desktop/ArcGISRuntimeSDKDotNet_DesktopSamples/Samples/Mapping/LayerList.xaml"&gt;'LayerList' sample &lt;/A&gt;which demonstrates how to display a list of layers with the possibility to turn on/off each layer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Nov 2014 09:05:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/dynamicmapservicelayer-added-through-code-not/m-p/400803#M4771</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2014-11-26T09:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: DynamicMapServiceLayer added through code not recognized by button.</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/dynamicmapservicelayer-added-through-code-not/m-p/400804#M4772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dominique.&amp;nbsp; I had not looked at the LayerList Sample.&amp;nbsp; Your comment about the CanExecute method helped me see the error of my ways. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your response.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Dec 2014 16:03:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/dynamicmapservicelayer-added-through-code-not/m-p/400804#M4772</guid>
      <dc:creator>ThomasCox</dc:creator>
      <dc:date>2014-12-02T16:03:20Z</dc:date>
    </item>
  </channel>
</rss>

