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?