Select to view content in your preferred language

Legend TOC from Template, Checkbox not working!

1101
5
10-03-2012 02:52 PM
Jitendrudulacaraju
Emerging Contributor
Silverlight 4 application. Made legend templates. The Checkbox on the TOC module is not working. here is the xaml code for the template:

<DataTemplate x:Key="LayerTemplate">
        <StackPanel  Margin="0,-1" Orientation="Horizontal">
            <ToolTipService.ToolTip>
                <StackPanel MaxWidth="400">
                    <TextBlock FontWeight="Bold" Text="{Binding Layer.ID}" TextWrapping="Wrap" />
                    <TextBlock FontWeight="Bold" Text="{Binding Label}" TextWrapping="Wrap" />
                    <TextBlock Text="{Binding Description}" TextWrapping="Wrap" />
                    <TextBlock Text="{Binding SubLayerID, StringFormat='SubLayer ID : {0}'}" />
                   
                </StackPanel>
            </ToolTipService.ToolTip>
            <Grid>
                <!--<CheckBox IsChecked="{Binding IsEnabled, Mode=TwoWay}" VerticalAlignment="Center"/>-->
                <CheckBox Content="{Binding Label}"  IsChecked="{Binding IsEnable, Mode=TwoWay}"
                          IsEnabled="{Binding IsInScaleRange,Mode=TwoWay}" IsHitTestVisible="False" VerticalAlignment="Center"/>
            <!--<TextBlock Text="{Binding Label}" VerticalAlignment="Center"/>-->
            </Grid>
        </StackPanel>
    </DataTemplate>
0 Kudos
5 Replies
DominiqueBroux
Esri Frequent Contributor
The Checkbox on the TOC module is not working 
<CheckBox Content="{Binding Label}" IsChecked="{Binding IsEnable, Mode=TwoWay}"
IsEnabled="{Binding IsInScaleRange,Mode=TwoWay}" IsHitTestVisible="False" VerticalAlignment="Center"/>


Setting IsHitTestVisible to false prevents any input from the mouse or the keyboard.
Set it to true or keep the default value instead.
0 Kudos
Jitendrudulacaraju
Emerging Contributor
Setting IsHitTestVisible to false prevents any input from the mouse or the keyboard.
Set it to true or keep the default value instead.


Ok , done that. But Now I want to turn on / off several sublayers within a Map service layers from the TOC. I can check/uncheck the button, but it does not change the visibility of the layer.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Ok , done that. But Now I want to turn on / off several sublayers within a Map service layers from the TOC. I can check/uncheck the button, but it does not change the visibility of the layer.


If your map service is cached, you can't change the visibility of the sublayers. The reason being that the image are pregenerated at the server side with the visibilities defined by the service.
The workaround might be either to create a non cached service or to create one cached service by layer (or by group of layers you want to manage together).
Though, both solutions have performance impacts.
0 Kudos
Jitendrudulacaraju
Emerging Contributor
If your map service is cached, you can't change the visibility of the sublayers. The reason being that the image are pregenerated at the server side with the visibilities defined by the service.
The workaround might be either to create a non cached service or to create one cached service by layer (or by group of layers you want to manage together).
Though, both solutions have performance impacts.


I did make one caches service by layer(s), that is turn off or on all together. But to manage each sub layer individually under a map service layer, I should be serving up a non cached layer, am I right ?
0 Kudos
DominiqueBroux
Esri Frequent Contributor
But to manage each sub layer individually under a map service layer, I should be serving up a non cached layer, am I right ?

Right. Cached map services don't support changing sublayers visibility.
0 Kudos