ArcGIS Runtime SDK for .NET Samples

Manage operational layers

Manage operational layers in the map

Loading

Code

<UserControl
    x:Class="ArcGISRuntime.UWP.Samples.ManageOperationalLayers.ManageOperationalLayers"
    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">
    <UserControl.Resources>
        <DataTemplate x:Key="LayerItemTemplate">
            <TextBlock Text="{Binding Name}" />
        </DataTemplate>
        <Style x:Key="LayerListStyle" TargetType="ListView">
            <Setter Property="Background" Value="LightGray" />
            <Setter Property="MinHeight" Value="100" />
            <Setter Property="HorizontalAlignment" Value="Stretch" />
            <!-- Allow items to be dropped on the listview. -->
            <Setter Property="AllowDrop" Value="True" />
            <!-- Allow items to be dragged out of the listview. -->
            <Setter Property="CanDragItems" Value="True" />
            <!-- Allow items to be reordered within the listview -->
            <Setter Property="CanReorderItems" Value="True" />
        </Style>
    </UserControl.Resources>
    <Grid>
        <esriUI:MapView Map="{Binding Map}" />
        <Border Style="{StaticResource BorderStyle}">
            <StackPanel Orientation="Vertical">
                <TextBlock Text="Drag and drop layers to add, remove, and reorder them."
                           TextWrapping="Wrap"
                           TextAlignment="Left" />
                <TextBlock Text="Layers in map"
                           TextAlignment="Center"
                           FontWeight="SemiBold" />
                <!-- Item template defined in UserControl.Resources above specifies that each listbox 
                     item's content consists of a label with the layer's Name property displayed. -->
                <ListView Style="{StaticResource LayerListStyle}"
                          ItemsSource="{Binding IncludedLayers,Mode=TwoWay}"
                          ItemTemplate="{StaticResource LayerItemTemplate}"
                          DragOver="ListBox_OnDragOver"
                          Drop="ListBox_OnDrop"
                          DragItemsStarting="ListBox_OnDragItemsStarting" />
                <TextBlock Text="Layers not in map"
                           TextAlignment="Center"
                           FontWeight="SemiBold" />
                <!-- Item template defined in UserControl.Resources above specifies that each listbox 
                     item's content consists of a label with the layer's Name property displayed. -->
                <ListView Style="{StaticResource LayerListStyle}"
                          ItemsSource="{Binding ExcludedLayers}"
                          DragOver="ListBox_OnDragOver"
                          DragItemsStarting="ListBox_OnDragItemsStarting"
                          Drop="ListBox_OnDrop"
                          ItemTemplate="{StaticResource LayerItemTemplate}" />
            </StackPanel>

        </Border>
    </Grid>
</UserControl>


In this topic
  1. Code