Within an overlay, I want to move a layer up or down so it’ll appear below or above another layer within the same overlay. Here’s some sample code:
var layerIndex = ((LayerOverlay)MyMap.Overlays[overlayName]).Layers.IndexOf(layer); // retrieved layer in previous step
if (layerIndex < 0)
{
return;
}
var overlay = MyMap.Overlays[overlayName];
((LayerOverlay)MyMap.Overlays[overlayName]).Layers.MoveDown(layerIndex); // I can see the order in the Layers collection properly change after this call
MyMap.Overlays[overlayName].Refresh(); // does not refresh the map
I’ve tried several of the refreshes, including refreshing just the current extent, refreshing the whole map, etc. Nothing actually refreshes the map. However, if I zoom in/out I can then see the changes. Is there something I’m missing?
Also, if I pan partly across the area of the affected layers, and then pan back, I can see the correct order of the layers for just that “slice” of the map. Is there some caching stuff going on in the moveup/down functions?