Skip To Content ArcGIS for Developers Sign In Dashboard

Group layers

A scene with a group layer

Loading

<UserControl
    x:Class="ArcGISRuntime.UWP.Samples.GroupLayers.GroupLayers"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:esriUI="using:Esri.ArcGISRuntime.UI.Controls"
    xmlns:mapping="using:Esri.ArcGISRuntime.Mapping">
    <Grid>
        <esriUI:SceneView x:Name="MySceneView" />
        <Border Style="{StaticResource BorderStyle}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <TextBlock Text="Select layers for display."
                           Grid.Row="0" Margin="5"
                           Foreground="Black" FontWeight="SemiBold" TextAlignment="Center" />
                <!-- This is a workaround until UWP TreeView supports proper HierarchicalDataTemplate. -->
                <ListView SelectionMode="None"
                          ItemsSource="{Binding ElementName=MySceneView,Path=Scene.OperationalLayers}"
                          Grid.Row="1">
                    <ListView.ItemTemplate>
                        <DataTemplate x:DataType="mapping:Layer">
                            <StackPanel>
                                <CheckBox IsChecked="{Binding IsVisible,Mode=TwoWay}"
                                          Content="{Binding Name,Mode=OneWay}" />
                                <ListView SelectionMode="None" ItemsSource="{Binding SublayerContents}"
                                          Margin="15,0,0,0">
                                    <ListView.ItemTemplate>
                                        <DataTemplate x:DataType="mapping:ILayerContent">
                                            <StackPanel>
                                                <CheckBox IsChecked="{Binding IsVisible,Mode=TwoWay}"
                                                          Content="{Binding Name,Mode=OneWay}" />
                                            </StackPanel>
                                        </DataTemplate>
                                    </ListView.ItemTemplate>
                                </ListView>
                            </StackPanel>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </Grid>
        </Border>
    </Grid>
</UserControl>

In this topic
  1. Code