views:

26

answers:

0

I'm creating a plugin for Outlook 2010 using VSTO 2010 and .NET 4. I am using the XML method to design my ribbon because I need the context-menu hooks. Unfortunately, though the ribbon is created before the Startup event handler of the addin is fired, I can't access the ribbon using Globals.Ribbons.MyRibbon in the handler! I have added the following in my Ribbon.cs code:

partial class ThisRibbonCollection : Microsoft.Office.Tools.Ribbon.RibbonReadOnlyCollection
{
  internal MyRibbon MyRibbon
  {
    get { return this.GetRibbon<MyRibbon>(); }
  }
}

But it seems that the RibbonReadOnlyCollection is empty when I try to access it from the startup event handler.

On the other hand, if I use the designer, I can access the collection with no problem. How do I add my new ribbon into the collection? I don't see any set methods or any instance of the ribbon collection that's tweakable.