If you need to loop through all ribbon tabs, ribbon bars and items on each ribbon bar here is how to do it.

C#

foreach (BaseItem item in ribbonControl1.Items)
{
    RibbonTabItem ribbonTab = item as RibbonTabItem;
 
    if (ribbonTab != null)
    {
        RibbonPanel panel = ribbonTab.Panel;
 
        foreach (Control panelControl in panel.Controls)
        {
            RibbonBar ribbonBar = panelControl as RibbonBar;
 
            if (ribbonBar != null)
            {
                // At this point you can simply disable each RibbonBar and that will disable all items on it
 
                //ribbonBar.Enabled = false;
 
                // Here is how you loop through items on RibbonBar
 
                foreach (BaseItem ribbonBarItem in ribbonBar.Items)
                    ribbonBarItem.Enabled = false;
            }
        }
    }
}

VB

For Each item As BaseItem In ribbonControl1.Items
    Dim ribbonTab As RibbonTabItem = TryCast(item, RibbonTabItem)
 
    If ribbonTab IsNot Nothing Then
        Dim panel As RibbonPanel = ribbonTab.Panel
 
        For Each panelControl As Control In panel.Controls
            Dim ribbonBar As RibbonBar = TryCast(panelControl, RibbonBar)
 
            If ribbonBar IsNot Nothing Then
                ' At this point you can simply disable each RibbonBar and that will disable all items on it

                'ribbonBar.Enabled = false;

                ' Here is how you loop through items on RibbonBar

                For Each ribbonBarItem As BaseItem In ribbonBar.Items
                    ribbonBarItem.Enabled = False
                Next
            End If
        Next
    End If
Next

Related posts:

  1. How to hide Ribbon Control System Buttons (Minimize, Maximize, Close) and other system parts of the Ribbon control
  2. How To Perform Custom Ribbon Merging
  3. Tips when working with Ribbon control from code
  4. How To Enable Control Hosting On Quick Access Toolbar Items
  5. Global Items