AnsweredAssumed Answered

How to control layer-visibilty individually with LayerTemplate

Question asked by fabian.gis on Dec 2, 2015
Latest reply on Apr 5, 2016 by fabian.gis

We are using ArcGIS Runtime .NET 10.2.6 and the legend-control in ArcGIS Runtime Toolkit for Windows Desktop.

 

We are trying to add a checkbox to each subLayer from a DynamicMapService to switch visibility. We've been able to add a checkbox defined in a LayerTemplate.

So far, we have (based on the runtime .NET sample "LegendsInTreeViewSample):

<esri:Legend x:Name="legend2" Layers="{Binding Converter={StaticResource enumerator}}" ShowOnlyVisibleLayers="False" >
                                            <esri:Legend.LayerTemplate>
                                                <DataTemplate>
                                                    <StackPanel Orientation="Horizontal">
                                                        <CheckBox Content="{Binding Label}"  IsChecked="{Binding IsEnabled, Mode=TwoWay}"/>
                                                    </StackPanel>
                                                </DataTemplate>
                                            </esri:Legend.LayerTemplate>
                                        </esri:Legend>

runtime_layerTemplate.PNG

In line 5 the binding of the property "Label" works fine, it shows the layers lable.

Unfortunately it doesn't work with the property "IsEnabled": if one checkbox is cheked/unchecked, all other layers on the same level are also affected .

 

Has anyone experienced similar behavior?

Is there a workaround to achieve the desired behavior?

 

 

Thanks in advance,

 

Fabian

Outcomes