SubLayer List

This sample includes a Map with and ArcGISLocalTiledLayer and an ArcGISLocalDynamicMapServiceLayer. A layer list shows the local sub layer names, a visibility check box, and a slider to adjust opacity. Each local layer can be toggled off and on and the opacity levels adjusted.

Element binding in XAML is used to populate the ListBox contents and enable interactivity between layers and UI elements in the layer list.

Download Sample Application
XAML C# VB.NET
<UserControl x:Class="ArcGISWPFSDK.LocalSubLayerList"
    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" >
        <Grid.Resources>
            <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
            <LinearGradientBrush x:Key="PanelGradient" EndPoint="0.5,1" StartPoint="0.5,0">
                <LinearGradientBrush.RelativeTransform>
                    <TransformGroup>
                        <ScaleTransform CenterY="0.5" CenterX="0.5"/>
                        <SkewTransform CenterY="0.5" CenterX="0.5"/>
                        <RotateTransform Angle="176" CenterY="0.5" CenterX="0.5"/>
                        <TranslateTransform/>
                    </TransformGroup>
                </LinearGradientBrush.RelativeTransform>
                <GradientStop Color="#FF145787" Offset="0.16"/>
                <GradientStop Color="#FF3D7FAC" Offset="0.502"/>
                <GradientStop Color="#FF88C5EF" Offset="0.984"/>
            </LinearGradientBrush>
        </Grid.Resources>
        <esri:Map x:Name="MyMap" WrapAround="True" Extent="-15000000,2000000,-7000000,8000000" Background="#FFE3E3E3" MinimumResolution="2445.98490512499">
            <esri:ArcGISLocalTiledLayer ID="Shaded Relief" Path="..\\Data\\TPKs\\Topographic.tpk"/>
            <esri:ArcGISLocalDynamicMapServiceLayer ID="USA" x:Name="USA"
              Path="..\\Data\\MPKS\\USCitiesStates.mpk" Initialized="ArcGISLocalDynamicMapServiceLayer_Initialized"/>
        </esri:Map>
        <Border Background="{ StaticResource PanelGradient}" BorderThickness="1" CornerRadius="5"
                HorizontalAlignment="Right"  VerticalAlignment="Top"
                Margin="20" Padding="10" BorderBrush="Black" >
            <StackPanel>
                <TextBlock Text="Layers in USA service" FontWeight="Bold" Foreground="White" />
                <ListBox x:Name="List" ItemsSource="{Binding ElementName=USA, Path=Layers, Mode=OneWay}" Background="#DDFFFFFF">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <CheckBox Margin="2" Content="{Binding Name, Mode=OneWay}" 
                                          IsChecked="{Binding DefaultVisibility, Mode=OneWay}" 
                                          Tag="USA"
                                          ClickMode="Press" Click="CheckBox_Click"  />
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </StackPanel>
        </Border>
        <ProgressBar x:Name="MyProgressBar" IsIndeterminate="True" VerticalAlignment="Bottom" Width="200" Height="20" Margin="10" Visibility="{Binding Path=IsBusy, Converter={StaticResource BooleanToVisibilityConverter}}"></ProgressBar>
    </Grid>
</UserControl>

Sample code usage restrictions
5/16/2014