Silverlight Templated Legend not functioning correctly using 3.0 Silverlight API.

378
1
11-19-2012 05:41 PM
ScottDickison
New Contributor III
Good evening,

For reference we are running SL5 and using v3.0 of the Silverlight API with 10.0 ArcGIS Server supported by 10.0 SDE.

In one of our applications we have a legend that is templated like this:

 <Style TargetType="esri:Legend">
            <Setter Property="LayerItemsMode" Value="Tree" />
            <Setter Property="ShowOnlyVisibleLayers" Value="False" />

            <Setter Property="MapLayerTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <CheckBox Content="{Binding Label}"
                  IsChecked="{Binding IsEnabled, Mode=TwoWay}"
                  IsEnabled="{Binding IsInScaleRange}"
                             />
                            <Slider Maximum="1" Value="{Binding Layer.Opacity, Mode=TwoWay}" Width="50" />
                        </StackPanel>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="LayerTemplate">
                <Setter.Value>
                    <DataTemplate x:Name="LayerItemTemplate">
                        <StackPanel Orientation="Horizontal">
                            <CheckBox Content="{Binding Label}" 
               IsChecked="{Binding IsEnabled, Mode=TwoWay}"
               IsEnabled="{Binding IsInScaleRange}"
                              />
                        </StackPanel>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>


What is happening is that as the map extent changes the layers with scale dependencies display but the legend never updates to reflect that and the layers stay grayed out. This worked properly under SL4 and Silverlight API v2.4.

We've also tried the example found here:http://broux.dominique.free.fr/Silverlight/InteractiveSDK/Default.htm#LegendTOC. This example works better in that it will allow you to turn the layers on and off but the scale dependent layers in the legend still stay greyed out when they are drawing.

Has anyone seen this behavior before?

Thanks,

Scott Dickison
KYTC GIS Branch,
Frankfort KY
0 Kudos
1 Reply
DominiqueBroux
Esri Frequent Contributor
We've also tried the example found here:http://broux.dominique.free.fr/Silve....htm#LegendTOC. This example works better in that it will allow you to turn the layers on and off but the scale dependent layers in the legend still stay greyed out when they are drawing.


I am not able to reproduce the issue, could you give more info on how to reproduce it?

This example works better in that it will allow you to turn the layers on and off

That's because in the example there are 2 checkboxes that overlaps, one with 'IsEnabled="{Binding IsInScaleRange}"' to get a grayed effect, one without setting IsEnabled to be able to turn on/off the layers even if they are not currently visible.
0 Kudos