RibbonDropDown will lose positions

I am adding items to RibbonDropDown , which is used during the execution of the New Email inspector . I add items at startup, and also update the list on demand (when the user clicks a button)

 public void RefreshListNames() { Logger.Log("Refresh Mail Lists"); Globals.Ribbons.Ribbon1.rddListNames.Items.Clear(); foreach (KeyValuePair<Guid, string> kvp in _dda.GetMarketingListNames()) { Microsoft.Office.Tools.Ribbon.RibbonDropDownItem dd = Globals.Factory.GetRibbonFactory().CreateRibbonDropDownItem(); dd.Tag = kvp.Key; dd.Label = kvp.Value; Logger.Log("Adding " + dd.Label); Globals.Ribbons.Ribbon1.rddListNames.Items.Add(dd); } Globals.Ribbons.Ribbon1.rddListNames.ResumeLayout(); } 

Note. rddListNames is RibbonDropDown

This method is called in the ThisAddIn_Startup method and is populated at startup. However, any new Mail window ends with an empty drop-down list - there are no elements. Even updating the list does not add items back.

I have added several protocols: it shows that this method starts when you click the Refresh button:

 23/04/2013 14:36:43 - Refresh Mail Lists 23/04/2013 14:36:45 - Adding Marketing List - Dynamic 23/04/2013 14:36:45 - Adding Marketing List - Bs 23/04/2013 14:36:45 - Adding Marketing List - As 

Why does falling down continue to lose ground? And why don't they come back even if I explicitly update them?

+4
source share
1 answer

If you make management changes to the Ribbon UI , you need to invalidate the cache control through IRibbonControl.Invalidate() or IRibbonControl.InvalidateControl . This will cause the redrawing of the ribbon elements.

 Globals.Ribbons.Ribbon1.Invalidate(); // or... Globals.Ribbons.Ribbon1.InvalidateControl("ddMarketingList"); 
+1
source

All Articles