Enable/Disable buttons in Add-ins for office 2007 using C# at runt

  • Thread starter Montreal Addin Dot Net Developer
  • Start date
M

Montreal Addin Dot Net Developer

Hi,

I have develeped Add-ins that contain buttons for Office 2007 using C#. I
would like to enable/disable some buttons in runtime. Can you please show me
how Can I implemente this feature ?

Thanks for your help.
 
J

Jayme.Pechan

When you want to update the buttons call:

currentRibbon.Invalidate();

The currentRibbon variable can be populated with:

Office.IRibbonUI currentRibbon = null;
public void ribbonLoaded(Office.IRibbonUI ribbon)
{
currentRibbon = ribbon;
}

This requires your ribbon xml file to have the onLoad="ribbonLoaded" on the
root tag.

Then in your ribbon xml set the button property to get the enabled state by
calling a function such as :

getEnabled="IsEnabled"

Then create your IsEnabled function which will return true/false depending
on whether the button should be enabled or disabled.

Hope this helps.

Jayme Pechan
Whitefeld
 
J

Jayme.Pechan

When you want to update the buttons call:

currentRibbon.Invalidate();

The currentRibbon variable can be populated with:

Office.IRibbonUI currentRibbon = null;
public void ribbonLoaded(Office.IRibbonUI ribbon)
{
currentRibbon = ribbon;
}

This requires your ribbon xml file to have the onLoad="ribbonLoaded" on the
root tag.

Then in your ribbon xml set the button property to get the enabled state by
calling a function such as :

getEnabled="IsEnabled"

Then create your IsEnabled function which will return true/false depending
on whether the button should be enabled or disabled.

Hope this helps.

Jayme Pechan
Whitefeld
 
J

Jayme.Pechan

When you want to update the buttons call:

currentRibbon.Invalidate();

The currentRibbon variable can be populated with:

Office.IRibbonUI currentRibbon = null;
public void ribbonLoaded(Office.IRibbonUI ribbon)
{
currentRibbon = ribbon;
}

This requires your ribbon xml file to have the onLoad="ribbonLoaded" on the
root tag.

Then in your ribbon xml set the button property to get the enabled state by
calling a function such as :

getEnabled="IsEnabled"

Then create your IsEnabled function which will return true/false depending
on whether the button should be enabled or disabled.

Hope this helps.

Jayme Pechan
Whitefeld
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top