AnsweredAssumed Answered

IMap value is invalid

Question asked by sergey.gamayunov_1 on Oct 31, 2014
Latest reply on Dec 30, 2014 by jeffmatson

Why ArcMap.Application.Document is null on run? There is my addin. It consist of tool and docWindow. DocWindow opens when tool is selected. When I run ArcMap with selected myTool and opened window, ArcMap.Application.Document is null.

If I call this from DockPanelClass (or other class) :

IMxDocument doc = ArcMap.Application.Document as IMxDocument; IMap map = doc.FocusMap;

map contains 0 layers;

But when I call it from MyToolClass it becomes valid and contains all my map layers. What happens?

Outcomes