<?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: Layer.IsVisible binding not working in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/layer-isvisible-binding-not-working/m-p/408251#M4842</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Binding expressions are only valid on objects that inherit from FrameworkElement controls (ie the MapView), since only these have a DataContext. A Map isn't a FrameworkElement, and thus doesn't inherit a DataContext.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The way we suggest you build your app is to put your Map (with all its layers in your ViewModel), you then bind this to the MapView.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Similarly you could bind List Control to the Map's Layers collection, and inside the list place CheckBoxes that binds to the Layer's IsVisible property.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So think of it this way: "Your Map is the model, the MapView is the view."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;esri:MapView Map="{Binding Map, Mode=OneWay}" /&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;CheckBox IsChecked="{Binding Map.Layers[0].IsVisible, Mode=TwoWay}" /&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Aug 2017 18:47:01 GMT</pubDate>
    <dc:creator>dotMorten_esri</dc:creator>
    <dc:date>2017-08-23T18:47:01Z</dc:date>
    <item>
      <title>Layer.IsVisible binding not working</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/layer-isvisible-binding-not-working/m-p/408250#M4841</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it possible to set (working) binding on Layer.IsVisible property? As far as I tried, I could not manage to make it work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;lt;esri:MapView&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;esri:Map&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;esri:WmtsLayer ServiceUri="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fgeoportal.cuzk.cz%2FWMTS_ZM%2FWMTService.aspx" rel="nofollow" target="_blank"&gt;http://geoportal.cuzk.cz/WMTS_ZM/WMTService.aspx&lt;/A&gt;&lt;SPAN&gt;" &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TileMatrixSet="jtsk:epsg:5514"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IsVisible="{Binding ShowBaseLayer}"/&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/esri:Map&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;&amp;lt;/esri:MapView&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On my view model, &lt;SPAN style="font-family: 'andale mono', monospace;"&gt;PropertyChanged&lt;/SPAN&gt; event is raised properly whenever the &lt;SPAN&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;ShowBaseLayer&lt;/SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;property changes. However, the layer is always visible, no matter what the value of &lt;SPAN style="font-family: 'andale mono', monospace;"&gt;ShowBaseLayer&lt;/SPAN&gt; property is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I missing something here? Is my approach correct? (Binding works properly on the rest of my page, thus there is no problem with setting DataContext/wrong DataContext/etc. here)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using ArcGIS Runtime 10.2.7 for Desktop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any tips,&lt;/P&gt;&lt;P&gt;Jan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Aug 2017 11:49:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/layer-isvisible-binding-not-working/m-p/408250#M4841</guid>
      <dc:creator>JanPalas</dc:creator>
      <dc:date>2017-08-22T11:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: Layer.IsVisible binding not working</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/layer-isvisible-binding-not-working/m-p/408251#M4842</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Binding expressions are only valid on objects that inherit from FrameworkElement controls (ie the MapView), since only these have a DataContext. A Map isn't a FrameworkElement, and thus doesn't inherit a DataContext.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The way we suggest you build your app is to put your Map (with all its layers in your ViewModel), you then bind this to the MapView.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Similarly you could bind List Control to the Map's Layers collection, and inside the list place CheckBoxes that binds to the Layer's IsVisible property.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So think of it this way: "Your Map is the model, the MapView is the view."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;esri:MapView Map="{Binding Map, Mode=OneWay}" /&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;CheckBox IsChecked="{Binding Map.Layers[0].IsVisible, Mode=TwoWay}" /&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Aug 2017 18:47:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/layer-isvisible-binding-not-working/m-p/408251#M4842</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2017-08-23T18:47:01Z</dc:date>
    </item>
  </channel>
</rss>

