GSandro_Strongs
GSandro_Strongs

Reputation: 841

How to go through the controls of a ribbon in devexpress winform

Hi everybody I'm trying to get all the names of the ribbon pages' ribbon form, the ribbon pages groups and bar buttom items and show them in a gridcontrol's XtraForm childForm. In my case I did it:

DataTable dt = new DataTable();
dt.Clear();
dt.Columns.Add("ID");
dt.Columns.Add("PAGE");
dt.Columns.Add("GROUP");
dt.Columns.Add("OPTION");
DataRow dr;
XtraForm frm = (XtraForm)Application.OpenForms["FrmPrincipal"];
RibbonControl parentRibbon = (RibbonControl)frm.Controls["ribbon"];
//parentRibbon.Pages.GetPageByText
foreach (RibbonPageGroup group in parentRibbon.SelectedPage.Groups)
{
    foreach (BarItemLink link in group.ItemLinks)
    {
        dr = dt.NewRow();
        dr["PAGE"] = parentRibbon.SelectedPage.Text;
        dr["GROUP"] = group.Text;
        dr["OPTION"] = link.Caption;
        dt.Rows.Add(dr);
    }
}
gcData.DataSource = dt;

enter image description here The problem is that I got the names of the ribbon page focused. How can I get all even the other ribbon pages?. Thanks in advance

Upvotes: 1

Views: 446

Answers (1)

Davide Piras
Davide Piras

Reputation: 44605

This is because you are looping through all groups of SelectedPage so you do not even access other pages if the RibbonControl

if you nest your loop inside another loop where you loop through all pages of parentRibbon.Pages then you will be able to find all groups in all pages

Upvotes: 1

Related Questions