/* 2008 Jos� Manuel Men�ndez Poo * * Please give me credit if you use this code. It's all I ask. * * Contact me for more info: menendezpoo@gmail.com * */ using System; using System.Collections.Generic; using System.Text; namespace System.Windows.Forms { /// <summary> /// Represents a collection of items that is hosted by the RibbonItemGroup /// </summary> public class RibbonItemGroupItemCollection : RibbonItemCollection { private RibbonItemGroup _ownerGroup; /// <param name="ownerGroup">Group that this collection belongs to</param> internal RibbonItemGroupItemCollection(RibbonItemGroup ownerGroup) { _ownerGroup = ownerGroup; } /// <summary> /// Gets the group that owns this item collection /// </summary> public RibbonItemGroup OwnerGroup { get { return _ownerGroup; } } /// <summary> /// Adds the specified item to the collection /// </summary> public new void Add(RibbonItem item) { item.MaxSizeMode = RibbonElementSizeMode.Compact; item.SetOwnerGroup(OwnerGroup); base.Add(item); } /// <summary> /// Adds the specified range of items /// </summary> /// <param name="items">Items to add</param> public new void AddRange(IEnumerable<RibbonItem> items) { foreach (RibbonItem item in items) { item.MaxSizeMode = RibbonElementSizeMode.Compact; item.SetOwnerGroup(OwnerGroup); } base.AddRange(items); } /// <summary> /// Inserts the specified item at the desired index /// </summary> /// <param name="index">Desired index of the item</param> /// <param name="item">Item to insert</param> public new void Insert(int index, RibbonItem item) { item.MaxSizeMode = RibbonElementSizeMode.Compact; item.SetOwnerGroup(OwnerGroup); base.Insert(index, item); } } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)