Transition Between Layers Online

This sample demonstrates a technique for creating a smooth visual transition when changing the visibility of a layer. The static CompositionTarget class represents the display surface of a Silverlight application. The CompositionTarget.Rendering event is used to determine when a frame of visuals are rendered. This sample uses the Rendering event to change layer visibility and opacity and create a smooth visual fade from one layer to another.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.LayerTransitions"
    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">
            <esri:ArcGISTiledMapServiceLayer ID="Streets" Visible="True" 
                    Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" />
            <esri:ArcGISTiledMapServiceLayer ID="Topo" Visible="False"
                    Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" />
            <esri:ArcGISTiledMapServiceLayer ID="Imagery" Visible="False"
                    Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer" />
            <esri:ArcGISTiledMapServiceLayer ID="Oceans" Visible="False"
                    Url="http://services.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer" />
            <esri:ArcGISTiledMapServiceLayer ID="NatGeo" Visible="False"
                    Url="http://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer" />
        </esri:Map>
        <Border HorizontalAlignment="Right" VerticalAlignment="Top" Padding="5" Margin="10"
                Background="White">
            <Border.Effect>
                <DropShadowEffect />
            </Border.Effect>
            <StackPanel Orientation="Horizontal">
                <RadioButton IsChecked="true" Margin="5,0,0,0" GroupName="Layers" 
                             Content="Streets" Checked="RadioButton_Checked" />
                <RadioButton Margin="5,0,0,0" GroupName="Layers" 
                             Content="Topo" Checked="RadioButton_Checked" />
                <RadioButton Margin="5,0,0,0" GroupName="Layers" 
                             Content="Imagery" Checked="RadioButton_Checked" />
                <RadioButton Margin="5,0,0,0" GroupName="Layers" 
                             Content="Oceans" Checked="RadioButton_Checked" />
                <RadioButton Margin="5,0,0,0" GroupName="Layers"
                             Content="NatGeo" Checked="RadioButton_Checked" />
            </StackPanel>
        </Border>
    </Grid>
</UserControl>

Sample code usage restrictions
5/16/2014