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.

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
add comment

1 Answer

up vote 4 down vote accepted

Doh!

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
add comment

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.