Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 349869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:29:55+00:00 2026-05-12T11:29:55+00:00

I have successfully used the Excel and Word addin templates in Visual studio 2008

  • 0

I have successfully used the Excel and Word addin templates in Visual studio 2008 to create a project that adds to the ribbon, but I am having difficulty with shared addins. I have created an add in that uses a xml file to modify and add to the ribbon and I can catch the events from buttons added, but I can’t for the life of me figure out how to hide buttons or add controls once it is up and running. Basically I need some kind of reference to a ribbon and all I can get is a reference to an object that implements IRibbonUi which does not help. Does anyone have any good shared add-in examples or advice?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T11:29:55+00:00Added an answer on May 12, 2026 at 11:29 am

    There are two possible ways to control the visibility of your ribbon controls. You can either use the visible property or the getVisible event. Both approachs require modifying the xml file you are already using.

    If this is your partial xml file now:

    <button id="MyButton" label="Hello" onAction="MyButtonOnAction"/>
    

    Then you can hide the control by changing it to:

    <button id="MyButton" label="Hello" onAction="MyButtonOnAction" visible="false"/>
    

    This isn’t much use as it is hardcoded. To get closer to what you are looking for change the xml to:

    <button id="MyButton" label="Hello" onAction="MyButtonOnAction" getVisible="MyButtonGetVisible"/>
    

    And then in the same way you have done the MyButtonOnAction callback you create the MyButtonGetVisible callback which happens to have this signature (C#):

    bool MyButtonGetVisible(IRibbonControl control)
    

    With this method you can then return true or false depending on whether you want to show/hide the button. The next question you might have is, the MyButtonGetVisible callback is only ever called once right after my add-in is loaded. I want to show/hide the button later on, how do I get the callback to trigger?

    To accomplish this you can use that IRibbonUI object you have and call the Invalidate function which will cause your entire ribbon to be invalidated which will cause the callback to be called. If you require finer control you can call the InvalidateControl function which takes the ControlID as a parameter, and will only invalidate one control, which will cause the callback to be called.

    As for adding controls on the fly, I don’t believe that to be possible.

    Further resources I would suggest:
    Part 1
    Part 2
    Part 3

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have successfully connected to an Oracle database (10g) from C# (Visual Studio 2008)
I have successfully used the following command line to create a new GIF image
I'm using Microsoft SQL Svr Mgmt Studio 2008. I don't have access to create
I have successfully used the C++ example project to draw graphs from my C++
I need to used dynamic order query in mysql and i have successfully achieved
What various methods and technologies have you used to successfully address scalability and performance
I have successfully set up FILESTREAM on my SQL 2008 server; however I've noticed
I have successfully used EF4 to insert rows automatically with a server generated GUID:
I have created a tool that imports an excel sheet. The excel COM object
I have successfully used ajax to refresh in-line, via ajax, a contact form. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.