Skip to main content
Bar

BarItemLinkCollection Class

A collection of bar item links.

Namespace: DevExpress.XtraBars

Assembly: DevExpress.XtraBars.v24.2.dll

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