Skip to main content
Version: 4.2

DataGridViewColumnGroupCollection

Namespace: Wisej.Web

Assembly: Wisej.Framework (4.2.0.0)

Contains all column groups owned by a DataGridView. Collection order determines the display order of groups with the same parent.

public class DataGridViewColumnGroupCollection : BaseCollection, IList, IList<DataGridViewColumnGroup>, ICollection<DataGridViewColumnGroup>, IEnumerable<DataGridViewColumnGroup>

Derives from or implements BaseCollection, IList, IList.

  • Owner Returns the grid that owns this collection.

Constructors​

Instance member DataGridViewColumnGroupCollection(dataGrid)​

Initializes a collection owned by the specified grid.

NameTypeDescription
dataGridDataGridViewThe grid that owns the collection.

Properties​

Instance member Item(index)​

DataGridViewColumnGroup: Returns the group at the specified index.

Instance member Item(name)​

DataGridViewColumnGroup: Returns the group with the specified name, or null when it is not found.

Instance member List​

IList: Returns the underlying group collection.

Instance member Owner​

DataGridView: Returns the grid that owns this collection.

Methods​

Instance member Add(group)​

Adds a group and returns its index in the collection.

ParameterTypeDescription
groupDataGridViewColumnGroupThe group to add.

Returns: Int32. The index of the added group.

Instance member Add(name, text)​

Adds a new group with the specified name and text.

ParameterTypeDescription
nameStringThe name of the new group.
textStringThe text displayed in its header.

Returns: DataGridViewColumnGroup. The new column group.

Instance member AddRange(groups)​

Adds groups in the specified order. Parents may occur after their children.

ParameterTypeDescription
groupsDataGridViewColumnGroup[]The groups to add, in collection order.

Instance member Clear()​

Removes all groups and clears column group assignments.

Instance member Clear(dispose)​

Removes all groups and optionally disposes them.

ParameterTypeDescription
disposeBooleanTrue to dispose the removed groups.

Instance member Contains(group)​

Returns whether the collection contains the specified group.

ParameterTypeDescription
groupDataGridViewColumnGroupThe group to locate.

Returns: Boolean. True when the group belongs to this collection.

Instance member CopyTo(array, index)​

Copies the groups to an array.

ParameterTypeDescription
arrayDataGridViewColumnGroup[]The destination array.
indexInt32The first destination index.

Instance member IndexOf(group)​

Returns the index of a group, or -1 when it is not found.

ParameterTypeDescription
groupDataGridViewColumnGroupThe group to locate.

Returns: Int32. The zero-based index, or -1 when the group is not found.

Instance member Insert(index, group)​

Inserts a group at the specified position.

ParameterTypeDescription
indexInt32The zero-based insertion index.
groupDataGridViewColumnGroupThe group to insert.

Protected member OnCollectionChanged(action, element)​

Raises the CollectionChanged event.

ParameterTypeDescription
actionCollectionChangeActionThe reason the collection changed.
elementObjectThe affected group, or null for a collection refresh.

Instance member Remove(group)​

Removes a group and promotes its direct columns and child groups to its parent.

ParameterTypeDescription
groupDataGridViewColumnGroupThe group to remove.

Instance member RemoveAt(index)​

Removes the group at the specified index.

ParameterTypeDescription
indexInt32The zero-based index of the group to remove.

Instance member SetGroupIndex(group, newIndex)​

Moves a group to the specified collection index without changing its parent.

ParameterTypeDescription
groupDataGridViewColumnGroupThe group to move.
newIndexInt32The new zero-based collection index.

Events​

Instance member CollectionChanged​

CollectionChangeEventHandler Occurs when a group is added, removed, or moved within the collection.