Newly created Data Frame will not allow user to show Properties dialog in ArcMap

1722
2
Jump to solution
11-05-2014 02:36 AM
Highlighted
New Contributor III

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();

}

1 Solution

Accepted Solutions
Highlighted
New Contributor III

I figured it out now.  Basically missing this line of code:

ArcMap.Document.PageLayout.ReplaceMaps(maps);

View solution in original post

2 Replies
Highlighted
New Contributor III

I figured it out now.  Basically missing this line of code:

ArcMap.Document.PageLayout.ReplaceMaps(maps);

View solution in original post

Highlighted
Occasional Contributor III

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.

Reply
0 Kudos