Back to Devexpress

How to: Iterate through items that belong to a specific category

windowsforms-5421-controls-and-libraries-ribbon-bars-and-menu-examples-bars-how-to-iterate-through-items-that-belong-to-a-specific-category.md

latest709 B
Original Source

How to: Iterate through items that belong to a specific category

  • Nov 13, 2018

The following sample code removes all links to the items displayed in the “Custom” category.

csharp
if (barManager1.Categories.IndexOf("Custom") != -1)
   for (int i = 0; i < barManager1.Categories["Custom"].GetItemCount(); i++)
      barManager1.Categories["Custom"].GetItem(i).Links.Clear();
vb
If BarManager1.Categories.IndexOf("Custom") <> -1 Then
   Dim i As Integer
   For i = 0 To BarManager1.Categories("Custom").GetItemCount() - 1
      BarManager1.Categories("Custom").GetItem(i).Links.Clear()
   Next i
End If