AnsweredAssumed Answered

Adding multiple layers in specific ORDER.

Question asked by bbirbo2008 on May 28, 2015
Latest reply on Jul 15, 2015 by mnielsen-esristaff

Hi.

 

I am adding 1 basemap and 6 feature layers to a map.

 

The problem is that the "OpenAsync" call is causing the map to add the layers with a different order that i initially called them.

 

Please take a look at the following code:

 

void _mapView_LayerLoaded(object sender, LayerLoadedEventArgs e)

{

       if (e.Layer.ID == "basemap")

       {

                loadOtherLayers();

       }

}

 

void loadOtherLayers()

           load_feature_layer_extras((int)LayerIdEnum_Extra.LayerAreas, "AREA");

           load_feature_layer_extras((int)LayerIdEnum_Extra.LayerBlocks, "BLOCKS");

           load_feature_layer_extras((int)LayerIdEnum_Extra.LayerRoads, "ROAD NETWORK");

 

           load_feature_layer_extras((int)LayerIdEnum.LayerLinks, "LINKS");

           load_feature_layer_extras((int)LayerIdEnum.LayerContainers, "CONTAINERS");

           load_feature_layer_extras((int)LayerIdEnum.LayerNodes, "NODES");

 

}

 

private async void load_feature_layer_extras(int layerId, string layerName)

{

          var featureLayer = await Esri.ArcGISRuntime.Data.ServiceFeatureTable.OpenAsync(new Uri(unetworkServiceURL_Extra + string.Format("FeatureServer/{0}", layerId)));

          featureLayer.Mode = QueryMode.OnDemand;

 

          var flayer = new FeatureLayer(featureLayer)

          {

              ID = layerId.ToString(),

              DisplayName = layerName,

              IsVisible = false

          };

 

          _mapView.Map.Layers.Add(flayer);


}

How do i make sure that all 6 layers ends up in the same order that i called them ?

 

Thanks in Advance.

Outcomes