I want to:
- create new data frame,
- give it a name,
- activate it and then fill with layers, etc. in ArcMap .NET custom command.
With this code I achieve 1. and 2., but don't know how to activate it:
// mxDocument is IMxDocument IMap newMap = mxDocument.Maps.Create(); newMap.Name = "I can name it as I want: " + Guid.NewGuid(); mxDocument.Maps.Add(newMap); //HOW TO Activate newMap??? mxDocument.UpdateContents();
New data frame is created, added to TOC but how to make it active?
mxDocument.ActiveView.FocusMap = newMap
EDIT: IMaps.Create() + IMaps.Add() is too primitive way to create a data frame, it won't work properly. See this link for a better description.