Skip to main content
Bar

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

BarItemLinkCollection Class

A collection of bar item links.

Namespace: DevExpress.XtraBars

Assembly: DevExpress.XtraBars.v24.2.dll

NuGet Package: DevExpress.Win.Navigation

#Declaration

public class BarItemLinkCollection :
    BarItemLinkReadOnlyCollection,
    BarLinksHolder,
    IList,
    ICollection,
    IEnumerable,
    IEnumerable<BarItemLink>

#Remarks

All commands end-users see within toolbars are bar item links. A bar item link is a visual representation of a bar item. Use the ItemLinks property of bar items, page groups, popup menus, and toolbars to get item links.

Read the following topics for additional information:

This example hides duplicated links (BarItemLink) based on the selected option:

Hide Duplicated Bar Item Links

using System;
using DevExpress.XtraBars;
using DevExpress.XtraBars.Ribbon;

namespace DXApplication {
    public partial class Form1 : RibbonForm {
        public Form1() {
            InitializeComponent();
        }
        void radioGroup1_SelectedIndexChanged(object sender, EventArgs e) {
            ShowAllBarItemLinks();
            switch (radioGroup1.SelectedIndex) {
                case 1:
                    ShowBarItemLinks(ribbonPageGroup1.ItemLinks);
                    break;
                case 2:
                    ShowBarItemLinks(ribbonPageGroup2.ItemLinks);
                    break;
                case 3:
                    ShowBarItemLinks(ribbonControl1.Toolbar.ItemLinks);
                    break;
                default:
                    break;
            }
        }
        void ShowBarItemLinks(BarItemLinkCollection links) {
            foreach (BarItemLink link in links) {
                HideDuplicatedLinks(link.Item, link.LinkedObject);
            }
        }
        void HideDuplicatedLinks(BarItem item, object linkedObject) {
            foreach (BarItemLink link in item.Links) {
                link.Visible = link.LinkedObject == linkedObject;
            }
        }
        void ShowAllBarItemLinks() {
            foreach (BarItem item in ribbonControl1.Items) {
                foreach (BarItemLink link in item.Links) {
                    link.Visible = true;
                }
            }
        }
    }
}

#Inheritance

Object
ReadOnlyCollectionBase
DevExpress.XtraBars.ReadOnlyListBase
BarItemLinkReadOnlyCollection
BarItemLinkCollection
See Also