<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Custom TOC layer problem on getting Mxdocument from Axmapcontrol in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/custom-toc-layer-problem-on-getting-mxdocument/m-p/1227#M30</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If your application is not running inside of ArcMap then you can't have an IMxDocument reference or an IApplication reference.&amp;nbsp; IMxDocument refers to an ArcMap document and IApplication refers to the ArcMap application itself.&amp;nbsp; If you're not inside of ArcMap then neither of those things exist in your application.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Dec 2011 12:21:20 GMT</pubDate>
    <dc:creator>NeilClemmons</dc:creator>
    <dc:date>2011-12-20T12:21:20Z</dc:date>
    <item>
      <title>Custom TOC layer problem on getting Mxdocument from Axmapcontrol</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/custom-toc-layer-problem-on-getting-mxdocument/m-p/1226#M29</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;i am adding a layers to axmapcontrol like&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;axMapControl1.Map.AddLayer((ILayer)rasterLayer);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;//i tried this for getting the mxdocument from axmapcontol where app&amp;nbsp; is comming null.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; public IMxDocument OnCreate(object hook)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_hookHelper = new HookHelperClass();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_hookHelper.Hook = hook;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IApplication app = m_hookHelper.Hook as IApplication;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IMxDocument appDocument = (IMxDocument)app.Document;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return appDocument;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//invoke usrcntrl library.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TOCLayerFilter tc = new TOCLayerFilter();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; IMxDocument imx= (IMxDocument)m_application.Document;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;tc.Activate(axMapControl1.hWnd, imx)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;kindly help asap...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;////&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;to tell my question more clearly .. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;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&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//00010000026q000000"&gt;http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//00010000026q000000&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Dec 2011 04:07:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/custom-toc-layer-problem-on-getting-mxdocument/m-p/1226#M29</guid>
      <dc:creator>ilankumaranm</dc:creator>
      <dc:date>2011-12-20T04:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: Custom TOC layer problem on getting Mxdocument from Axmapcontrol</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/custom-toc-layer-problem-on-getting-mxdocument/m-p/1227#M30</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If your application is not running inside of ArcMap then you can't have an IMxDocument reference or an IApplication reference.&amp;nbsp; IMxDocument refers to an ArcMap document and IApplication refers to the ArcMap application itself.&amp;nbsp; If you're not inside of ArcMap then neither of those things exist in your application.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Dec 2011 12:21:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/custom-toc-layer-problem-on-getting-mxdocument/m-p/1227#M30</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2011-12-20T12:21:20Z</dc:date>
    </item>
  </channel>
</rss>

