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

When I set the onDemand="false" attribute, my buttons disappear from my menu!

I'm setting the attribute to false so that I control its behaviour using the OnUpdate override in code. Am I doing anything wrong?

<Button id="SayHi_Btn" onDemand="false" class="SayHiButton" caption="Say Hi!" image="Images\SayHi_Btn.png" />
<Button id="SayHello_Btn" onDemand="false" class="SayHelloButton" caption="Say Hello!" image="Images\SayHello_Btn.png" />
<Button id="SayAloha_Btn" onDemand="false" class="SayAlohaButton" caption="Say Aloha!" image="Images\SayAloha_Btn.png" />
<Menu id="ChooseGreeting_RootMenu" caption="Choose Greeting" isRootMenu="true">
<Button refID="SayHello_Btn" separator="true" />
<Button refID="SayAloha_Btn" />
<Button refID="SayHi_Btn" />
share|improve this question
up vote 0 down vote accepted

Just found that if there are any uncaught exceptions being thrown inside the OnUpdate, then the buttons disappear from the menu items.

Best to implement robust exception management inside the OnUpdate method to prevent unexpected behaviour by the buttons.

using ESRI.ArcGIS.Desktop.AddIns;

namespace ArcMapAddIn
    public class MyCustomButton : Button
        private readonly MyExtension _myExtension;

        public MyCustomButton()
            _myExtension = AddIn.FromID(ThisAddIn.IDs.MyExtension);

            Enabled = false;

        protected override void OnClick()
            new MessageBox.Show("My Custom Button clicked!");

        protected override void OnUpdate()
            Enabled = _myExtension.CanShowCustomMessage;
            // if uncaught excpetion is thrown here- this button gets removed from menu item
share|improve this answer

Your Answer


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.