1

我需要循环遍历 RibbonPageGroup 中的所有项目。我尝试将所有功能区项目的 Visibility 属性设置为“true/always”

    For Each rp As RibbonPage In ribbonControl.Pages
        rp.Visible = True
            For Each pg As RibbonPageGroup In rp.Groups
                    pg.Visible = True
                  For Each btn As DevExpress.XtraBars.BarButtonItem In pg.??????
                      btn.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
                Next
          Next
    Next
4

3 回答 3

2

RibbonPageGroup中没有条形项目。您可以通过RibbonPageGroup.ItemLinks属性迭代栏项目链接。

请参阅访问栏项目和链接文章了解更多信息。

于 2013-05-13T08:33:03.253 回答
1

您可以使用 LINQ 执行此操作:

For Each bbi As var In RbpVersion.ItemLinks.Cast(Of BarItemLink)().[Select](Function(x) x.Item)
  Console.WriteLine(bbi.Caption)
Next
于 2013-07-25T17:45:00.720 回答
0

我有同样的问题。用这段编码对其进行排序。完美运行:

For Each pagegroup As DevExpress.XtraBars.Ribbon.RibbonPage In rbnSafety.Pages
    For Each group As DevExpress.XtraBars.Ribbon.RibbonPageGroup In pagegroup.Groups
        For Each button As DevExpress.XtraBars.BarButtonItem In group.Ribbon.Items.OfType(Of DevExpress.XtraBars.BarButtonItem)()
        If button.Name <> "rbtnExit" Then
           button.Enabled = False
        End If
        Next
        For Each button As DevExpress.XtraBars.BarSubItem In group.Ribbon.Items.OfType(Of DevExpress.XtraBars.BarSubItem)()
            button.Enabled = False
        Next
     Next
 Next
于 2013-10-02T13:21:33.757 回答