ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / ServiceCompositeSubLayer Class
Members Example

In This Topic
    ServiceCompositeSubLayer Class
    In This Topic
    Represents a service composite sub layer.
    Object Model
    ServiceCompositeSubLayer ClassLayer ClassCIMDataConnection ClassCIMBaseLayer ClassSpatialReference ClassMap ClassILayerContainer InterfaceEnvelope Class
    Syntax
    Example
    Adding and changing styles for WMS Service Layer
    var serverConnection = new CIMInternetServerConnection { URL = "https://spritle.esri.com/arcgis/services/sanfrancisco_sld/MapServer/WMSServer" };
    var connection = new CIMWMSServiceConnection { ServerConnection = serverConnection };
    LayerCreationParams parameters = new LayerCreationParams(connection);
    parameters.MapMemberPosition = MapMemberPosition.AddToBottom;
    await QueuedTask.Run(() =>
    {
      var compositeLyr = LayerFactory.Instance.CreateLayer<WMSLayer>(parameters, MapView.Active.Map);
      //wms layer in ArcGIS Pro always has a composite layer inside it
      var wmsLayers = compositeLyr.Layers[0] as ServiceCompositeSubLayer;
      //each wms sublayer belongs in that composite layer
      var highwayLayerWMSSub = wmsLayers.Layers[1] as WMSSubLayer;
      //toggling a sublayer's visibility
      if ((highwayLayerWMSSub != null))
      {
        bool visibility = highwayLayerWMSSub.IsVisible;
        highwayLayerWMSSub.SetVisibility(!visibility);
      }
      //applying an existing style to a wms sub layer
      var pizzaLayerWMSSub = wmsLayers.Layers[0] as WMSSubLayer;
      var currentStyles = pizzaLayerWMSSub.GetStyleNames();
      pizzaLayerWMSSub.SetStyleName(currentStyles[1]);
    });
    Inheritance Hierarchy

    System.Object
       ArcGIS.Desktop.Framework.Contracts.PropertyChangedBase
          ArcGIS.Desktop.Mapping.MapMember
             ArcGIS.Desktop.Mapping.Layer
                ArcGIS.Desktop.Mapping.CompositeLayer
                   ArcGIS.Desktop.Mapping.ServiceCompositeSubLayer

    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also