Button displays caption not image on toolbar add-In

804
2
02-17-2014 10:05 AM
BenjaminHillam
New Contributor II
I created an Add-in using the ArcObjects SDK for .Net in Visual Studio 2010.  Initially I just had one button on the toolbar.  Later I decided to add another button.  I added the the button manually in the Config.esriaddinx file.  as shown below.

[HTML]
<AddIn  language="CLR"
            library="SearchDBByLocationTool.dll"
            namespace="SearchDBByLocationTool">
    <ArcMap>
      <Commands>
        <Button  id="SearchDBByLocationTool_SearchDBByLocationButton"
                    class="SearchDBByLocationButton"
                    message="Searches the DB for any PDF, JPG, GIS data, or all three
                                  found within a geographic location"
                    caption="Search Database"
                    tip="Click to search database for geo-located data by a defined area
                          of interest"
                    category="Add-In Controls"
                    image="Images\SearchDBByLocationButton.png"/>
<Button  id="SearchDBByLocationTool_AddResultLayersToMapButton"
                    class ="AddResultLayersToMapButton"
                    message="Takes the selected features from the results of the database                             search and adds the resulting GIS layer"
                    caption="Add Selected Result"
                    tip="Click to add the selected GIS layers to the map (only on GIS
                          data not pdf or photos)"
                    category="Add-In Controls"
                    image="Images\MapWithStarBlue32.png"/>
      </Commands>
<Toolbars>
  <Toolbar  id ="SearchDBByLocationToolToolbar"
                             caption="Database Search"
                             showInitially="true">
      <Items>
               <Button refID="SearchDBByLocationTool_SearchDBByLocationButton"/>
        <Button refID="SearchDBByLocationTool_AddResultLayersToMapButton"/>
      </Items>
  </Toolbar>
</Toolbars>
    </ArcMap>
  </AddIn>
[/HTML]

My question is when I open up ArcMap why does my second button that I added manually to the Config.esriaddinx show the "Caption" instead of the "image" while the first button is displayed correctly? The first button has an image in the same folder as the second and its image shows on the button? What am I missing?
0 Kudos
2 Replies
VickiMartinez
New Contributor II
You have probably figured this out by now, but just in case you haven't... You might need to add the image to your project using Visual Studio.  You can quickly check by looking in your solution explorer and looking in the "Images" folder.  If it isn't referenced there, then you need to add it.[ATTACH=CONFIG]33175[/ATTACH]
0 Kudos
GaneshSurange
New Contributor II

Right-click on the image in visual studio solution, which you selected to display on AddIn button. Go to 'Properties' option -> Under 'Advanced' section -> 'Build Action' and select 'AddInContent' from the drop-down list. Save the changes -> rebuild solution -> Run, image should be displayed on the AddIn button.

0 Kudos