Switch Layers Online

This sample demonstrates how to change the Url of a single tiled map service layer at runtime. When a radio button is clicked, the code in the event handler is used to change the url of the layer.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.SwitchMap"
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:esri="http://schemas.esri.com/arcgis/client/2009">
    <Grid x:Name="LayoutRoot" Background="White">
        <esri:Map x:Name="MyMap" WrapAround="True" UseAcceleratedDisplay="True" Loaded="MyMap_Loaded">
            <esri:ArcGISTiledMapServiceLayer ID="AGOLayer" Visible="True" 
                    Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
        </esri:Map>

        <Grid HorizontalAlignment="Right" Background="#CC919191" VerticalAlignment="Top" Margin="10" >
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Background="Transparent" Margin="5">
                <RadioButton x:Name="StreetsRadioButton" 
                         Tag="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"
                         IsChecked="true" Margin="5,0,0,0" 
                         GroupName="Layers" Content="Streets" Click="RadioButton_Click"/>
                <RadioButton x:Name="TopoRadioButton" 
                         Tag="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" 
                         Margin="5,0,0,0"  
                         GroupName="Layers" Content="Topo" Click="RadioButton_Click"/>
                <RadioButton x:Name="ImageryRadioButton" 
                         Tag="http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer" 
                         Margin="5,0,0,0"  
                         GroupName="Layers" Content="Imagery" Click="RadioButton_Click"/>
            </StackPanel>
        </Grid>
    </Grid>
</UserControl>

Sample code usage restrictions
5/16/2014