var map = MapView.Active.Map; var kgLayer = map.GetLayersAsFlattenedList().OfType<KnowledgeGraphLayer>().FirstOrDefault(); if (kgLayer == null) return; if (map.MapType == MapType.LinkChart) { // if map is of MapType.LinkChart then the first level // children of the kgLayer are of type LinkChartFeatureLayer var childLayers = kgLayer.Layers; foreach (var childLayer in childLayers) { if (childLayer is LinkChartFeatureLayer lcFeatureLayer) { var isEntity = lcFeatureLayer.IsEntity; var isRel = lcFeatureLayer.IsRelationship; // TODO - continue processing } } } else if (map.MapType == MapType.Map) { // if map is of MapType.Map then the children of the // kgLayer are the standard Featurelayer and StandAloneTable var chidlren = kgLayer.GetMapMembersAsFlattenedList(); foreach (var child in chidlren) { if (child is FeatureLayer fl) { // TODO - process the feature layer } else if (child is StandaloneTable st) { // TODO - process the standalone table } } }
Target Platforms: Windows 11, Windows 10