Click or drag to resize

ArcGISSublayer Class

The base class for ArcGIS sublayer classes ArcGISMapImageSublayer and ArcGISTiledSublayer.
Inheritance Hierarchy

Namespace:  Esri.ArcGISRuntime.Mapping
Assembly:  Esri.ArcGISRuntime (in Esri.ArcGISRuntime.dll) Version: 100.11.0
Syntax
public abstract class ArcGISSublayer : INotifyPropertyChanged, 
	ILayerContent, IPopupSource, ILoadable

The ArcGISSublayer type exposes the following members.

Properties
  NameDescription
Public propertyCanChangeVisibility
Gets a value indicating whether the sublayer content's visibility can be changed.
Public propertyDefinitionExpression
Gets the definition expression of this sublayer.
Public propertyId
Gets an id that uniquely identifies this sublayer instance.
Public propertyIsPopupEnabled
Gets or sets a value indicating whether the PopupDefinition defined is enabled.
Public propertyCode exampleIsVisible
Gets or sets a value indicating whether the sublayer content is visible.
Public propertyLabelsEnabled
Gets a value indicating whether labels should be displayed on this sublayer.
Public propertyLoadError
Gets the Exception associated with the last load error.
Public propertyLoadStatus
Gets the load status.
Public propertyMapServiceSublayerInfo
Gets this sublayer's metadata.
Public propertyMaxScale
Gets the maximum scale at which this sublayer is visible.
Public propertyMinScale
Gets the minimum scale at which this sublayer is visible.
Public propertyName
Gets the name of the sublayer.
Public propertyOpacity
Gets the opacity of this sublayer.
Public propertyPopupDefinition
Gets or sets the popup definition for the sublayer.
Public propertyRenderer
Gets this sublayer's Renderer.
Public propertyScaleSymbols
Gets a value indicating whether this sublayer renders its symbols based on scale.
Public propertyShowInLegend
Gets or sets a value indicating whether the sublayer participates in the legend.
Public propertySublayerContents
Gets a read-only collection of ILayerContent for this sublayer.
Public propertySublayers
Gets the sublayers of this sublayer.
Top
Methods
  NameDescription
Public methodCancelLoad
Cancel loading metadata for the object.
Public methodClone
Clones this instance of the ArcGISSublayer and its members.
Public methodGetLegendInfosAsync
Asynchronously retrieves a read-only list of LegendInfo objects.
Public methodIsVisibleAtScale
Retrieves the sublayer's visibility at the specified scale.
Public methodLoadAsync
Load the metadata for the object asynchronously.
Public methodRetryLoadAsync
Load the metadata for the object asynchronously.
Top
Events
  NameDescription
Public eventLoaded
Event that is raised when the object is done loading.
Public eventLoadStatusChanged
Event that is raised when the LoadStatus property changes.
Top
Examples

WPF

Example Name: ChangeSublayerVisibility

Change the visibility of sublayers.

Code example screen shot.

C#
// Copyright 2016 Esri.
// 
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific 
// language governing permissions and limitations under the License.

using Esri.ArcGISRuntime.Mapping;
using System;
using System.Windows;

namespace ArcGISRuntime.WPF.Samples.ChangeSublayerVisibility
{
    [ArcGISRuntime.Samples.Shared.Attributes.Sample(
        name: "Map image layer sublayer visibility",
        category: "Layers",
        description: "Change the visibility of sublayers.",
        instructions: "Each sublayer has a check box which can be used to toggle the visibility of the sublayer.",
        tags: new[] { "layers", "sublayers", "visibility" })]
    public partial class ChangeSublayerVisibility
    {
        public ChangeSublayerVisibility()
        {
            InitializeComponent();

            // Setup the control references and execute initialization 
            Initialize();
        }

        private async void Initialize()
        {
            // Create new Map
            Map myMap = new Map();

            // Create uri to the map image layer
            Uri serviceUri = new Uri(
               "https://sampleserver6.arcgisonline.com/arcgis/rest/services/SampleWorldCities/MapServer");

            // Create new image layer from the url
            ArcGISMapImageLayer imageLayer = new ArcGISMapImageLayer(serviceUri)
            {
                Name = "World Cities Population"
            };

            // Add created layer to the basemaps collection
            myMap.Basemap.BaseLayers.Add(imageLayer);

            // Assign the map to the MapView
            MyMapView.Map = myMap;

            try
            {
                // Wait that the image layer is loaded and sublayer information is fetched
                await imageLayer.LoadAsync();

                // Assign sublayers to the listview
                SublayerListView.ItemsSource = imageLayer.Sublayers;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "Error");
            }
        }
    }
}
XAML
<UserControl x:Class="ArcGISRuntime.WPF.Samples.ChangeSublayerVisibility.ChangeSublayerVisibility"
             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/runtime/2013">
    <Grid>
        <esri:MapView x:Name="MyMapView" />
        <Border Style="{StaticResource BorderStyle}">
            <StackPanel>
                <TextBlock Text="Select sublayers for display."
                           TextWrapping="Wrap" TextAlignment="Center" FontWeight="SemiBold"
                           Margin="0,0,0,5" />
                <ListView x:Name="SublayerListView">
                    <ListView.ItemTemplate>
                        <DataTemplate DataType="esri:ArcGISSublayer">
                            <CheckBox Content="{Binding Name}"
                                      IsChecked="{Binding IsVisible}"
                                      Margin="5" />
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </StackPanel>
        </Border>
    </Grid>
</UserControl>
See Also
Additional Examples
Hyperlink to ExampleDescription
ChangeSublayerRendererApply a renderer to a sublayer.
ChangeSublayerVisibilityChange the visibility of sublayers.
IdentifyLayersIdentify features in all layers in a map. MapView supports identifying features across multiple layers. Because some layer types have sublayers, the sample recursively counts results for sublayers within each layer.
MapImageSublayerQueryFind features in a sublayer based on attributes and location.