Select to view content in your preferred language

problem with legend and ArcGISDynamicMapServiceLayer

543
1
03-24-2014 03:49 AM
DIALLOAbdoulaye
Emerging Contributor
Hello Every One,
i have a problem with the legend in arcgis APi For silverlight
in fact i want to show in the legend the layers in the ArcGISDynamicMapServiceLayer
so i have the XAML  code below

<esri:Legend x:Name="mylegend"  Grid.Row="2"      Height="205" Width="250"
Map="{Binding ElementName=Map,Path=Layers.[CASABLANCALAYER].Layers}" LayerItemsMode="Tree"
ShowOnlyVisibleLayers="False"  Background="#FFCBD1D7" />

and map content:

<esri:Map x:Name="Map"  WrapAround="true" Background="White" Extent="-865440,3963654,-821984,3980669" Margin="5,5,5,5">
        <esri:ArcGISTiledMapServiceLayer ID="BaseLayer"
                 Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer" />
       <esri:ArcGISDynamicMapServiceLayer ID="CASABLANCALAYER"
                 Url="http://diallo-pc-pc/ArcGIS/rest/services/CASASERVICEF/MapServer"
                                                />           
</esri:Map>

if i use a featurelayer  instead of  ArcGISDynamicMapServiceLayer that work properly so why we can show a featurelayer but not a arcgis dynamic layer in a legend ????

thanks in advance for any help

i am using VS 2010, arcgis API 3.1, Arcgis server 10 and dot net 4
0 Kudos
1 Reply
DominiqueBroux
Esri Frequent Contributor
Your binding to the Map is wrong.

Instead of:
Map="{Binding ElementName=Map,Path=Layers.[CASABLANCALAYER].Layers}" 

try
Map="{Binding ElementName=Map}" 
0 Kudos