I have created a custom ribbon button (Large Button) and a text field (Small Input Box). I can disable/enable these controls just fine when clicking an item (by the CommandState QueryState() override).

However, when clicking the button, I need to set some text to the text field and disable the button, and I haven't found any ways to do this.

How can I set the state (enable/disable, text) of other ribbon controls from a custom button?


You can change the text of the button by overriding the following method:

public override string GetHeader(CommandContext context, string header)
    //Build some logic here
    return "Modified header text";

Moreover, you can override the tooltip text by overriding this:

public override string GetToolTip(CommandContext context, string tooltip)
    return base.GetToolTip(context, tooltip);
  • I didn't mean the text of the button. I meant I want to change the text on the Small Input Box from the button.
    – GTHvidsten
    Mar 7 '19 at 8:54

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.