Legend Control cant find ischecked property

856
2
04-01-2011 11:40 AM
LuisCÃ_spedes
New Contributor
I added the new legend control and I want to use the "CheckBox_Checked" event within the legend to force a layer to uncheck itself when another layer is checked, but I cant find the IsChecked property for it. Here is what I want to do:

<esri:Legend Map="{Binding ElementName=MyMap}"
LayerItemsMode="Tree"
x:Name="l_legend"
ShowOnlyVisibleLayers="False"
Refreshed="Legend_Refreshed"
>
<esri:Legend.MapLayerTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<CheckBox x:Name="LayerCheckLegend" Content="{Binding Label}"
IsChecked="{Binding IsEnabled, Mode=TwoWay}"
IsEnabled="{Binding IsInScaleRange}"
Checked="CheckBox_Checked">


Private Sub CheckBox_Checked(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)

If l_legend.LayerItems(5).IsSelected = True Then

l_legend.LayerItems(6).IsSelected = True

End If

If l_legend.LayerItems(6).IsSelected = True Then
l_legend.LayerItems(5).IsSelected = False
End If

l_legend.Refresh()

But instead of IsSelected, IsChecked.

Is it there and I cant see it?
0 Kudos
2 Replies
DominiqueBroux
Esri Frequent Contributor
'IsChecked' is not a property of the 'LegendItems'.
If you are retemplating the legend control with CheckBoxes, 'IsChecked' is a property of the checkboxes.

I guess in your scenario you should instead set by code the 'IsEnabled' property.
0 Kudos
LuisCÃ_spedes
New Contributor
Thanks for the reply.
Yoda man.

        If l_legend.LayerItems(5).IsSelected Then
            l_legend.LayerItems(6).IsEnabled = False
        End If

        If l_legend.LayerItems(6).IsSelected Then
            l_legend.LayerItems(5).IsEnabled = False
        End If

Works!
0 Kudos