Reputation: 1410
I need to iterate with a loop through all the items in a RibbonPageGroup. I try to set the Visibility property from all Ribbon Items to '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
Upvotes: 1
Views: 4223
Reputation: 1
I had the same problem. Sorted it with this piece of coding. Works perfectly:
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
Upvotes: 0
Reputation: 17799
You could do this using LINQ:
For Each bbi As var In RbpVersion.ItemLinks.Cast(Of BarItemLink)().[Select](Function(x) x.Item)
Console.WriteLine(bbi.Caption)
Next
Upvotes: 1
Reputation: 17850
There are no bar items within the RibbonPageGroup. You can iterate bar item links via the RibbonPageGroup.ItemLinks property.
Please refer to Accessing Bar Items and Links article for more information.
Upvotes: 2