<?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 Creating combobox item for toolbar extention - no HWND in WPF in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-combobox-item-for-toolbar-extention-no/m-p/394347#M10522</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Guys.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am working an an extension for ArcGIS Desktop in Visual Studios and .net 4.0.&amp;nbsp; I Have created a working shell with a few buttons and some basic code to make sure everything will work as I like and am stuck on one last thing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to add a combo box to the toolbar (like the Map Scale drop down in the "Standard" toolbar of arc).&amp;nbsp; I found the form-based sample solution provided by ESRI called GraphicsLayerToolControl which has been a big help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But here is where I am stuck.&amp;nbsp; I am trying to do it all in WPF and the MVVM pattern.&amp;nbsp; I created a UserControl like in the sample but when I try to complete the command class for it I cannot properly build the required hWnd property.&amp;nbsp; Since this is WPF there is no native handle to be had.&amp;nbsp; I thought I could use the Interop function HwndSource.FromVisual to get it but that comes back null.&amp;nbsp; I think the problem is there is no equivalent "CreateControl()" function in WPF that the forms-based example relies on to force creation of the control&amp;nbsp; This is what that looks like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public int hWnd
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //pass the handle of the usercontrol
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (null == m_graphicsLayerListCtrl)
&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_graphicsLayerListCtrl = new GraphicsLayersListCtrl();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_graphicsLayerListCtrl.CreateControl();&amp;nbsp; //CANNOT FIND ANYTHING SIMILAR IN WPF
&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; return m_graphicsLayerListCtrl.Handle.ToInt32();

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a way to make this work or am I forced to do a forms-based usercontrol?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ernie&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Jan 2013 11:19:51 GMT</pubDate>
    <dc:creator>ErnieSalazar</dc:creator>
    <dc:date>2013-01-25T11:19:51Z</dc:date>
    <item>
      <title>Creating combobox item for toolbar extention - no HWND in WPF</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/creating-combobox-item-for-toolbar-extention-no/m-p/394347#M10522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Guys.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am working an an extension for ArcGIS Desktop in Visual Studios and .net 4.0.&amp;nbsp; I Have created a working shell with a few buttons and some basic code to make sure everything will work as I like and am stuck on one last thing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to add a combo box to the toolbar (like the Map Scale drop down in the "Standard" toolbar of arc).&amp;nbsp; I found the form-based sample solution provided by ESRI called GraphicsLayerToolControl which has been a big help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But here is where I am stuck.&amp;nbsp; I am trying to do it all in WPF and the MVVM pattern.&amp;nbsp; I created a UserControl like in the sample but when I try to complete the command class for it I cannot properly build the required hWnd property.&amp;nbsp; Since this is WPF there is no native handle to be had.&amp;nbsp; I thought I could use the Interop function HwndSource.FromVisual to get it but that comes back null.&amp;nbsp; I think the problem is there is no equivalent "CreateControl()" function in WPF that the forms-based example relies on to force creation of the control&amp;nbsp; This is what that looks like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public int hWnd
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //pass the handle of the usercontrol
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (null == m_graphicsLayerListCtrl)
&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_graphicsLayerListCtrl = new GraphicsLayersListCtrl();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_graphicsLayerListCtrl.CreateControl();&amp;nbsp; //CANNOT FIND ANYTHING SIMILAR IN WPF
&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; return m_graphicsLayerListCtrl.Handle.ToInt32();

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a way to make this work or am I forced to do a forms-based usercontrol?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Ernie&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jan 2013 11:19:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/creating-combobox-item-for-toolbar-extention-no/m-p/394347#M10522</guid>
      <dc:creator>ErnieSalazar</dc:creator>
      <dc:date>2013-01-25T11:19:51Z</dc:date>
    </item>
  </channel>
</rss>

