Hi,I am not able to reproduce the problem. If I understood correctly, you need to replace the layer at run-time.I am using the following code:XAML
<Grid x:Name="LayoutRoot" Background="White">
<esri:Map x:Name="MyMap" ExtentChanged="MyMap_ExtentChanged">
<esri:ArcGISTiledMapServiceLayer Url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
</esri:Map>
<Button Content="Replace Layer" Click="Button_Click" VerticalAlignment="Top" HorizontalAlignment="Center"/>
</Grid>
Code-behind:
private void Button_Click(object sender, RoutedEventArgs e)
{
ArcGISDynamicMapServiceLayer dynamic = new ArcGISDynamicMapServiceLayer() { Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/LandusePlanning/MapServer" };
dynamic.Initialize();
ArcGISTiledMapServiceLayer tiledLayer = this.MyMap.Layers[0] as ArcGISTiledMapServiceLayer;
if (tiledLayer != null)
{
this.MyMap.Layers.Remove(tiledLayer);
this.MyMap.Layers.Add(dynamic);
}
}
private void MyMap_ExtentChanged(object sender, ESRI.ArcGIS.Client.ExtentEventArgs e)
{
// placed a breakpoint here to make sure the map's extent still get updated after replacing layer.
}