Select to view content in your preferred language

How to show ArcGISLocalDynamicMapServiceLayer Symbol in Legend?

2864
1
10-02-2012 05:52 AM
Labels (1)
KevinChan
Emerging Contributor
I followed the online example on dynamically adding raster/shape files into the map. However, the legend does not show allow me to expand the layer to show the symbol that it is using.

Is there a way to show it? The WPF examples that came with the SDK DOES show it, but the layers are part of the map package, and not added dynamically, the template for the legend is the same also. So I have no idea.
Anyone can help me out, that would be great.

    
       <esri:Legend Map="{Binding ElementName=MyMap}"  
                         LayerIDs="USA"
                         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>
                            <Slider Maximum="1" Value="{Binding Layer.Opacity, Mode=TwoWay}" Width="50" />
                        </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>
            </esri:Legend>
0 Kudos
1 Reply
MichaelBranscomb
Esri Frequent Contributor
Hi,

The legend items for the contents of an ArcGISLocalDynamicMapServiceLayer can be shown in the Legend control but unfortunately at v1.0 we had a bug where the label and symbol swatch are not updated when the contents of the service changes.

This has been fixed for the next release.

Cheers

Mike
0 Kudos