Legend
This sample demonstrates the Legend control. The Legend control displays the symbology of specified Layers with text explanations of what the symbols mean in a Map an organized in a tree view hierarchy. The specific Layers that are displayed in the Legend control are controlled by what is specified in the LayersIDs Property.
For this sample, the LayerItemsMode Property is set to Tree meaning all sub-layers and groups will automatically be displayed in the Legend control. Users are free to collapse the symbology with text descriptions of the Legend for individual layers and sub-layers.
Download Sample Application<UserControl x:Class="ArcGISWPFSDK.LocalLegendSimple" 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" Extent="-15000000,2000000,-7000000,8000000" WrapAround="True" MinimumResolution="2445.98490512499"> <esri:ArcGISLocalTiledLayer ID="myBaseMap" Path="..\\Data\\TPKs\\Topographic.tpk"/> <esri:ArcGISLocalDynamicMapServiceLayer ID="USA" Path="..\\Data\\MPKS\\USCitiesStates.mpk"/> </esri:Map> <Border Background="{StaticResource PanelGradient}" BorderThickness="1" CornerRadius="5" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="20" Padding="5" BorderBrush="Black" > <esri:Legend Map="{Binding ElementName=MyMap}" LayerIDs="USA" LayerItemsMode="Tree" /> </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>
5/16/2014