Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I use ArcGIS 10.0 and ArcGIS .net SDK. I created AddIn project which contains Tool:

<Tool id="AddSearchLocationPoint"
  class="AddSearchLocationPoint"
  category="Add-In Controls"
  image="Images\insert.png" />

and DockableWindow:

<DockableWindow id="SearchDockableWindow"
                class="SearchDockableWindow"
                image="Images\SearchDockableWindow.png">
  <InitialPlacement height="360" width="570" state="pinned" position="right" />
</DockableWindow>

The dockableWindow contains WinForm’s HostElement which displays my WPF UserControl. Now I want to add a button to the WPF UserControl which will launch my tool. Do you know a way to raise the event which launches the tool?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Does the tool "Launch" or do you mean set it as the current tool? Maybe I'm not understanding your question.

I think you need to get an ICommandItem for your tool or button, similar to my answer here: Can you programmatically change the button image for a ESRI.ArcGIS.Desktop.AddIns.Button?

ICommandItem commandItem = ArcMap.Application.Document.CommandBars.Find(uid, true, true);
ArcMap.Application.CurrentTool = commandItem;

or if it isn't a tool, you could execute:

ICommandItem commandItem = ArcMap.Application.Document.CommandBars.Find(uid, true, true);
commandItem.Execute();
share|improve this answer

Your Answer

 
discard

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.