2

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?

1

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();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.