Skip To Content ArcGIS for Developers Sign In Dashboard

Manage operational layers

Manage operational layers in the map

Loading

<?xml version="1.0" encoding="utf-8"?>

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
             xmlns:mapping="clr-namespace:Esri.ArcGISRuntime.Mapping;assembly=Esri.ArcGISRuntime"
             xmlns:resources="clr-namespace:Forms.Resources;assembly=ArcGISRuntime"
             x:Class="ArcGISRuntimeXamarin.Samples.ManageOperationalLayers.ManageOperationalLayers">
    <ContentPage.Resources>
        <DataTemplate x:Key="LayerListTemplate" x:DataType="mapping:Layer">
            <ViewCell>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <Label Text="{Binding Name}" Grid.Column="0"
                           VerticalTextAlignment="Center" Margin="5" />
                    <Button Text="⬆" Grid.Column="1" Clicked="PromoteButton_Clicked" />
                    <Button Text="⬇" Grid.Column="2" Clicked="DemoteButton_Clicked" />
                    <Button Text="➡" Grid.Column="3" Clicked="MoveButton_OnClicked" />
                </Grid>
            </ViewCell>
        </DataTemplate>
    </ContentPage.Resources>
    <RelativeLayout>
        <esriUI:MapView x:Name="MyMapView" Style="{StaticResource MapWithFormStyle}"
                        BindingContext="{x:Reference Name=ResponsiveFormContainer}" />
        <resources:ResponsiveFormContainer x:Name="ResponsiveFormContainer">
            <StackLayout>
                <Label Text="Use the buttons to re-arrange layers." />
                <Label Text="Layers in map"
                       FontAttributes="Bold"
                       HorizontalTextAlignment="Center" />
                <!-- Item template defined in UserControl.Resources above specifies that each listbox 
                     item's content consists of a label with the layer's Name and three buttons. -->
                <ListView x:Name="IncludedListView"
                          VerticalOptions="Start"
                          HeightRequest="80"
                          ItemTemplate="{StaticResource LayerListTemplate}" />
                <Label Text="Layers not in map"
                       FontAttributes="Bold"
                       HorizontalTextAlignment="Center" />
                <!-- Item template defined in UserControl.Resources above specifies that each listbox 
                     item's content consists of a label with the layer's Name and three buttons. -->
                <ListView x:Name="ExcludedListView"
                          VerticalOptions="Start"
                          HeightRequest="80"
                          ItemTemplate="{StaticResource LayerListTemplate}" />
            </StackLayout>
        </resources:ResponsiveFormContainer>
    </RelativeLayout>
</ContentPage>

In this topic
  1. Code