I have code that creates new Data Frames, using IMaps.Create() and when you right click->Properties on the new Data Frames in ArcMap TOC, it never opens up the Properties window?! Anyone know whats going on here, have I missed something in the code?
The code is fairly basic:
internal static void AddNewMap(string mapName)
{
//Makes the new map the active focus map too.
IMxDocument mxd = ArcMap.Document;
IMaps maps = mxd.Maps;
IMap map = null;
if (maps.Count == 1 && maps.Item[0].Name != "Foo Name")
{
map = maps.Item[0];
}
else
{
map = maps.Create();
maps.Add(map);
}
map.Name = mapName;
IActiveView pActiveView = ArcMap.Document.ActiveView;
if (pActiveView is IPageLayout)
ArcMap.Document.ActiveView.FocusMap = map;
else
ArcMap.Document.ActiveView = (IActiveView)map;
ArcMap.Document.UpdateContents();
}
Solved! Go to Solution.
I figured it out now. Basically missing this line of code:
ArcMap.Document.PageLayout.ReplaceMaps(maps);
I figured it out now. Basically missing this line of code:
ArcMap.Document.PageLayout.ReplaceMaps(maps);
I'm finding that in Visual studio 2015 and ArcGIS 10.5.1 the IMaps.Add() method is hidden. It doesn't show up in intelisense and shows an error when typed out, but it still works and was the piece I was missing. Thank you, your code helped me figure it out.