I tried to create a simple webgis with silverlight. Software that I used to make the application: ArcGIS Desktop 10 (without sp), ArcGIS Server 10, Silverlight 4, Microsoft blend 4, and Visual Studio 2010 sp1. We generally use the code below to add layers to map:
<esri:Map x:Name="Map" >
<esri:Map.Layers>
<esri:ArcGISDynamicMapServiceLayer ID="samplewebgis"
Url="http://m-pc/arcgis/rest/services/test/MapServer" />
</esri:Map.Layers>
</esri:Map>
But when i use the code, the map legend shows no layers. then I tried the code below:
<esri:Map x:Name="Map" Grid.RowSpan="3">
<esri:FeatureLayer ID="xx" Url="http://m-pc/arcgis/rest/services/test/MapServer/0"/>
<esri:FeatureLayer ID="yy" Url="http://m-pc/arcgis/rest/services/test/MapServer/1" />
</esri:Map>
This code works properly and legend show layers. Why can't I use esri:map.layers and why can't the legend show layers of map when I use map.layers?