Group Layer Online
This sample shows the use of the GroupLayer to consolidate layers within a map. The map shown contains a tiled map service layer and a group layer. The sample shows a templated Legend and its support of GroupLayers. The legend's template supports toggling visibility of the layers within the GroupLayer.
Download Sample Application<UserControl x:Class="ArcGISWPFSDK.GroupLayer" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:esri="http://schemas.esri.com/arcgis/client/2009"> <Grid x:Name="LayoutRoot" Background="White"> <Grid.Resources> <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" Background="#FFE3E3E3"> <esri:Map.Extent> <esri:Envelope XMin="-15000000" YMin="2000000" XMax="-7000000" YMax="8000000" > <esri:Envelope.SpatialReference> <esri:SpatialReference WKID="102100"/> </esri:Envelope.SpatialReference> </esri:Envelope> </esri:Map.Extent> <esri:ArcGISTiledMapServiceLayer ID="TopoMapLayer" Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/> <esri:GroupLayer ID="USA"> <esri:FeatureLayer ID="Rivers" Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/1" Mode="OnDemand"/> <esri:FeatureLayer ID="Cities" Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/0" Mode="OnDemand" /> </esri:GroupLayer> </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}" LayerItemsMode="Tree" LayerIDs="USA" /> </Border> </Grid> </UserControl>
5/16/2014