ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / FeatureLayerCreationParams Class / FeatureLayerCreationParams Constructor / FeatureLayerCreationParams Constructor(CIMDataConnection)
A ArcGIS.Core.CIM.CIMDataConnection object.
Example

In This Topic
    FeatureLayerCreationParams Constructor(CIMDataConnection)
    In This Topic
    Creates a parameter object with a ArcGIS.Core.CIM.CIMDataConnection.
    Syntax
    Public Function New( _
       ByVal dataConnection As CIMDataConnection _
    )
    public FeatureLayerCreationParams( 
       CIMDataConnection dataConnection
    )

    Parameters

    dataConnection
    A ArcGIS.Core.CIM.CIMDataConnection object.
    Example
    Apply Symbology from a Layer in the TOC
    {
        //Note: Call within QueuedTask.Run()
        if (MapView.Active.Map == null) return;
    
        //Get an existing Layer. This layer has a symbol you want to use in a new layer.
        var lyr = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>()
              .Where(l => l.ShapeType == esriGeometryType.esriGeometryPoint).FirstOrDefault();
        //This is the renderer to use in the new Layer
        var renderer = lyr.GetRenderer() as CIMSimpleRenderer;
        //Set the DataConnection for the new layer
        Geodatabase geodatabase = new Geodatabase(
          new FileGeodatabaseConnectionPath(new Uri(@"E:\Data\Admin\AdminData.gdb")));
        FeatureClass featureClass = geodatabase.OpenDataset<FeatureClass>("Cities");
        var dataConnection = featureClass.GetDataConnection();
        //Create the definition for the new feature layer
        var featureLayerParams = new FeatureLayerCreationParams(dataConnection)
        {
            RendererDefinition = new SimpleRendererDefinition(renderer.Symbol),
            IsVisible = true,
        };
        //create the new layer
        LayerFactory.Instance.CreateLayer<FeatureLayer>(
          featureLayerParams, MapView.Active.Map);
    }
    Create Stream Layer with URI
    {
      // Note: call within QueuedTask.Run()
      {
        var url = "https://geoeventsample1.esri.com:6443/arcgis/rest/services/AirportTraffics/StreamServer";
        var createParam = new FeatureLayerCreationParams(new Uri(url))
        {
          IsVisible = false //turned off by default
        };
        streamLayer = LayerFactory.Instance.CreateLayer<StreamLayer>(createParam, map);
    
        //or use "original" create layer (will be visible by default)
        Uri uri = new Uri(url);
        streamLayer = LayerFactory.Instance.CreateLayer(uri, map) as StreamLayer;
        streamLayer.SetVisibility(false);//turn off
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also