ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / TopologyLayerCreationParams Class / AddAssociatedLayers Property
Example

In This Topic
    AddAssociatedLayers Property (TopologyLayerCreationParams)
    In This Topic
    Gets and sets whether the topology associated layers are to be added along with the topology layer. Default value is true.
    Syntax
    Public Property AddAssociatedLayers As Boolean
    public bool AddAssociatedLayers {get; set;}
    Example
    Create TopologyLayer with an Uri pointing to a Topology dataset
    {
        var path = @"D:\Data\CommunitySamplesData\Topology\GrandTeton.gdb\BackCountry\Backcountry_Topology";
        var lcp = new TopologyLayerCreationParams(new Uri(path));
        lcp.Name = "GrandTeton_Backcountry";
        lcp.AddAssociatedLayers = true;
        //Note: Needs QueuedTask to run
        var topoLayer = LayerFactory.Instance.CreateLayer<ArcGIS.Desktop.Mapping.TopologyLayer>(lcp, MapView.Active.Map);
    }
    Create Topology Layer using Topology dataset
    {
        //Get the Topology of another Topology layer
        var existingTopology = MapView.Active.Map.GetLayersAsFlattenedList().OfType<TopologyLayer>().FirstOrDefault();
        if (existingTopology != null)
        {
            var topology = existingTopology.GetTopology();
            //Configure the settings for a new Catalog layer using the CatalogDataset of an existing layer
            var topologyLyrParams = new TopologyLayerCreationParams(topology);
            topologyLyrParams.Name = "NewTopologyLayerFromAnotherTopologyLayer";
            topologyLyrParams.AddAssociatedLayers = true;
            //Note: Needs QueuedTask to run
            LayerFactory.Instance.CreateLayer<TopologyLayer>(topologyLyrParams, MapView.Active.Map);
        }
    }
    Requirements

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

    ArcGIS Pro version: 3.1 or higher.
    See Also