Is there a way to add a check box to each Legend Item to turn on/off a feature layer features?I have a feature service displaying point features using a renderer. The Legend displays three different Legend Items: a red maker [large leaks], a yellow marker [small leaks], and a blue marker [no leaks].The Legend XAML does place a check box for the layer, but not for each "Legend Item Template":<esri:Legend x:Name="mapLegend" Map="{Binding ElementName=MyMap}"
LayerItemsMode="Tree"
ShowOnlyVisibleLayers="False"
Refreshed="Legend_Refreshed">
<esri:Legend.MapLayerTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<CheckBox Content="{Binding Label}"
IsChecked="{Binding IsEnabled, Mode=TwoWay}"
IsEnabled="{Binding IsInScaleRange}" >
</CheckBox>
</StackPanel>
</DataTemplate>
</esri:Legend.MapLayerTemplate>
<esri:Legend.LayerTemplate>
<DataTemplate>
<CheckBox Content="{Binding Label}"
IsChecked="{Binding IsEnabled, Mode=TwoWay}"
IsEnabled="{Binding IsInScaleRange}" >
</CheckBox>
</DataTemplate>
</esri:Legend.LayerTemplate>
/* THE CODE IS FINE UNTIL HERE: I get a nice legend with 3 different markers and their proper Label. */
<esri:Legend.LegendItemTemplate>
<DataTemplate>
<CheckBox>
/* HERE IS MY PROBLEM: It places the red marker 3 times, while ignoring the other markers */
</CheckBox>
</DataTemplate>
</esri:Legend.LegendItemTemplate>
</esri:Legend>
If I get to add a check box next to each "LegendItemTemplate" then I can control display of my feature service layer from the legend items: Display only small leaks --> Check mark the "yellow" marker check box.Turn off small leaks --> Uncheck the "yellow" marker check box.And so forth...I could then retrieve those features specified by the check box event using code-behind; no problem here.Has anyone done something similar?Is this the proper way to achieve this?Your input is much appreciated.Hugo.