AnsweredAssumed Answered

PageLayout.ReplaceMaps switches order of dataframes

Question asked by jon.morris on May 29, 2015
Latest reply on Jun 23, 2015 by jon.morris

So, I have an ArcMap addin that, when you add a new map, changes the layout of the dataframes. The TOC remains in the same order, and the dataframes have the same sizes and positions, but the maps within them have moved round.

 

The code is very simple, just create the map, add it, then call ReplaceMaps:

        internal static void AddNewMap(string mapName)
        {
            if (ArcMap.Document == null)
                return;

            //Makes the new map the active focus map too.
            IMaps maps = ArcMap.Document.Maps;
            IMap map = null;

            map = maps.Create();
            maps.Add(map);
            map.Name = mapName + " (" + Utilities.SelectedRecipe.recipe + ")";

            //Set the reference scale for map frame
            double refscale = 0;
            if (Double.TryParse(Utilities.SelectedRecipe.refscale, out refscale))
                map.ReferenceScale = refscale;

            map.SpatialReference = WGS_1984CoordinateSystem;

            ArcMap.Document.PageLayout.ReplaceMaps(maps);

            // focus on new map
            IActiveView pActiveView = ArcMap.Document.ActiveView;
            if (pActiveView is IPageLayout)
                ArcMap.Document.ActiveView.FocusMap = map;
            else
                ArcMap.Document.ActiveView = (IActiveView)map;

            // refresh document
            ArcMap.Document.UpdateContents();
        }

 

I found this old post about what looks like the same bug; apparently "it is a known bug that they are working on".

 

Does anyone know any more about this?

Outcomes