...
Layer myLayer = null;
String sName = "ABC123";
Map map = MapView.Active.Map;
IEnumerable<Layer> matches = map.GetLayersAsFlattenedList().Where(l => l.Name.IndexOf(sName, StringComparison.CurrentCultureIgnoreCase) >= 0);
int index = 0;
if (matches.Count() == 1)
{
myLayer = matches.FirstOrDefault();
//index = position???
map.RemoveLayer(myLayer);
}
How do you insert it at the same location I originally found it ?
myLayer = LayerFactory.Instance.CreateGroupLayer(MapView.Active.Map, index, sName);
Thanks,