Esempio n. 1
0
        private void addItemToBar(DevExpress.XtraBars.Bar sourceItem, DevExpress.XtraBars.BarItem newItem)
        {
            DevExpress.XtraBars.BarItemLink linkForDelete = null;
            foreach (DevExpress.XtraBars.BarItemLink link in sourceItem.ItemLinks)
            {
                if (link.Caption == newItem.Caption) { linkForDelete = link; break; }
            }
            if (linkForDelete != null) sourceItem.RemoveLink(linkForDelete);

            int newID = sourceItem.ItemLinks.Count;
            newItem.Id = newID;
            sourceItem.AddItem(newItem);
        }