none
Initializing Ribbon Buttons RRS feed

  • Question

  • I am trying to initialize buttons on the ribbon based on information that is stored in variables that are in a Document template.

    When I try initializing the buttons in the Ribbon Load event it doesn't work and one of my buttons actually disappears.

    What event can I use to initialize the ribbon buttons in my VSTO Add-in?

    Tuesday, June 11, 2013 4:15 AM

Answers

  • start with all ribbon buttons disabled and provide callbacks in xml for getEnabled functions. When you actually get hold of your document template simply call ribbon.Invalidate() and your callbacks will be called again and this time with info from template you will take right decision about their visibility.
    Tuesday, June 11, 2013 7:08 AM
  • Got it sorted.  Seems having enabled=false in the XML in combination with GetEnabled was causing  conflict.

    Thursday, June 13, 2013 6:10 AM

All replies

  • start with all ribbon buttons disabled and provide callbacks in xml for getEnabled functions. When you actually get hold of your document template simply call ribbon.Invalidate() and your callbacks will be called again and this time with info from template you will take right decision about their visibility.
    Tuesday, June 11, 2013 7:08 AM
  • Thank you for the info.  I've never done call backs before but I will research it.  I think I understand the basis of what you are saying though.
    Thursday, June 13, 2013 2:59 AM
  • So I figured out how to export my Ribbon from the Ribbon Designer to XML.  Then I started using the XML version of the Ribbon.  I created a GetImage callback and added in the resources and that works fine.  Then I tried the GetEnabled callback but the ribbon doesn't event show if I use the GetEnabled callback for some reason.  More specifically, if I add getEnabled="GetEnabled" in the XML.
    Thursday, June 13, 2013 5:44 AM
  • Got it sorted.  Seems having enabled=false in the XML in combination with GetEnabled was causing  conflict.

    Thursday, June 13, 2013 6:10 AM