Get All Controls

How can i get all controls in ribboncontroladv such as toolstripdropdown items,toolstrip buttons ext.....


3 Replies 1 reply marked as answer

TB Thirupathi Bala Krishnan Syncfusion Team February 2, 2022 09:07 AM UTC

Hi Zafer, 
 
You can get the ribbons control components by making the following code changes in your application. The ToolStripTabItems collection is accessible via the RibbonControlAdv.Header.MainItems property. The RibbonControlAdv.Header.QuickItems property can be used to retrieve the QuickAccessPanel elements. After that, you can access the interior elements using the ribbon panel controls. 
 
Please refer to the following code sample. 
 
# Form1.cs

 
private void getRibbonItems() 
{ 
    // Get the ribbon tab 
    foreach (ToolStripTabItem toolStriptabItem in this.wordribbon.Header.MainItems) 
    { 
        string tabHeader = toolStriptabItem.Text.ToString(); 
 
        //Get the ribbon panel 
        RibbonPanel panel = toolStriptabItem.Panel; 
        if (panel != null) 
        { 
            foreach(ToolStripEx toolStripEx in panel.Controls) 
            { 
                if (toolStripEx != null) 
                { 
                    foreach(object obj in toolStripEx.Items) 
                    { 
                        if (obj is ToolStripDropDownButton) 
                        { 
                            ToolStripDropDownButton toolStripDropDownButton = obj as ToolStripDropDownButton; 
                        } 
                        else if(obj is ToolStripButton) 
                        { 
                            ToolStripButton toolStripDropDownButton = obj as ToolStripButton; 
                        } 
                        else if(obj is ToolStripPanelItem) 
                        { 
                            ToolStripPanelItem toolStripDropDownButton = obj as ToolStripPanelItem; 
                        } 
                        else if (obj is ToolStripGallery) 
                        { 
                            ToolStripGallery toolStripDropDownButton = obj as ToolStripGallery; 
                        } 
                    } 
                } 
            } 
        } 
    } 
} 
 
 
Please let us know if you need any further assistance. 
 
Regards,
Thirupathi B.
 


Marked as answer

ZE Zafer Ergül February 4, 2022 06:58 AM UTC

thank you so much.




TB Thirupathi Bala Krishnan Syncfusion Team February 4, 2022 08:35 AM UTC

Hi Zafer, 

We are glad to know that the provided solution resolved your reported issue at your end. Please let us know if you need any further assistance on this. As always, we are happy to assist you. 

Regards, 
Thirupathi B. 


Loader.
Up arrow icon