ilanmap

Custom TOC layer problem on getting Mxdocument from Axmapcontrol

Discussion created by ilanmap on Dec 19, 2011
Latest reply on Dec 20, 2011 by Neil
i am adding a layers to axmapcontrol like  
axMapControl1.Map.AddLayer((ILayer)rasterLayer);

Now i need to use a custom Toc layer which is usercontrol.i hve added the custom toc usercntrl dll and trying to send the Imxdocument from the Axmapcontrol. How to initialize the m_application such a way axmapcontrol will be considered as m_application and to send the document.
//i tried this for getting the mxdocument from axmapcontol where app  is comming null.

public IMxDocument OnCreate(object hook)
        {
                           m_hookHelper = new HookHelperClass();
                m_hookHelper.Hook = hook;

            IApplication app = m_hookHelper.Hook as IApplication;
            IMxDocument appDocument = (IMxDocument)app.Document;
            return appDocument;
  }

//invoke usrcntrl library.
TOCLayerFilter tc = new TOCLayerFilter();
IMxDocument imx= (IMxDocument)m_application.Document;
tc.Activate(axMapControl1.hWnd, imx)



kindly help asap...
////
to tell my question more clearly ..
i have wpf app with axcontrol hosted and raster layer in axcontrol ..and need to add the custom toc as in the link..the custom code has a activate method which gets the mxdocument,how do i pass from axmapcontrol..i added this dll in my app. how to pass mxd doc values to activate method
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//00010000026q000000

Outcomes