Hi,
I am trying to add 3 layers to a group layer in a specific index order. I use the FeatureLayerCreationParams object with the LayerFactory.Instance.CreateLayer() function - but when I look at the results in the TOC - the layers have come in a random order and not the order I specified.
This was working fine in 2.x but since I have moved to 3.x this code does not seem to work - I'm not sure what I can do but I need to fix the problem urgently.
Here is the code I use (I pass in my object called "layer", which holds the index information to pass on):
await QueuedTask.Run(() =>
{
Item stagingLayer = ItemFactory.Instance.Create(AgolId, ItemFactory.ItemType.PortalItem);
if (LayerFactory.Instance.CanCreateLayerFrom(stagingLayer))
{
var featureCreateParams = new FeatureLayerCreationParams(stagingLayer)
{
IsVisible = layer.Visible,
MapMemberIndex = layer.LayerOrder,
//Even this does NOT fix the issue
MapMemberPosition = MapMemberPosition.Index,
Name = layer.Name
};
LayerFactory.Instance.CreateLayer<FeatureLayer>(featureCreateParams, groupLayer);
}
});