Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I tried to get IGraphicsContainer from Data View (active map) using FocusMap, ActiveView

IGraphicsContainer graphicsContainer = (IGraphicsContainer)neApp.Document.MxDocument.FocusMap;

but the variable always null, is there any different way to do this?

I already get from page layout view in this question right here: Get IGraphicsContainer from page layout but i need it from data view (map).

share|improve this question
up vote 2 down vote accepted

The Map class does implement IGraphicsContainer, so most likely the problem is in the expression neApp.Document.MxDocument.FocusMap. Make sure it does not return null.

Also be aware that a map can contain multiple graphic layers. See the discussion in IMap.BasicGraphicsLayer documentation for details.

share|improve this answer
Thanks, can you know how to change the view from layout view to data view see this question,… – IBRA Dec 10 '12 at 7:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.