Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Currently in Config.esriaddinx I have

<Button id="my_UniqueID" class="MyWrapperClass" caption="My Caption"
         image="Images\My_Image.png" ...> </Button>

and then I implement MyWrapperClass with:

protected override void OnClick()
{
    UID uid = new UIDClass();
    uid.Value = "esriArcMapUI.GraphicsToFeaturesCommand";

    ICommandItem cmd = ArcMap.Application.Document.CommandBars.Find(uid);
    if (cmd != null)
        cmd.Execute();
}

I'd like to just have the following in Config.esriaddinx

<Button id="esriArcMapUI.GraphicsToFeaturesCommand" />

and have the built-in command object do all the work for me.

Is this possible?

share|improve this question
up vote 4 down vote accepted

Yes it is possible to reference a built-in command (button) on a custom menu/toolbar (What I really need to do). It is not possible to redefine a built-in command (What I was trying to do).

One can reference a built-in command on a custom menu/toolbar like this.

    <Menu id="my_id" caption="Cool_tools">
      <Items>
        <Button refID="my_custom_button" />
        <Button refID="esriArcMapUI.GraphicsToFeaturesCommand" />
        ...
      </Items>
    </Menu>

And similarly for a tool on a toolbar.

share|improve this answer
1  
Still, this is very useful and good to know. +1 – Petr Krebs Dec 13 '10 at 22:45

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.