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.
- C#
- VB.NET
public class DataGridViewColumnGroupCollection : BaseCollection, IList, IList<DataGridViewColumnGroup>, ICollection<DataGridViewColumnGroup>, IEnumerable<DataGridViewColumnGroup>
Public Class DataGridViewColumnGroupCollection
Inherits BaseCollection
Implements IList, IList(Of DataGridViewColumnGroup), ICollection(Of DataGridViewColumnGroup), IEnumerable(Of DataGridViewColumnGroup)
Derives from or implements BaseCollection, IList, IList.
- Owner Returns the grid that owns this collection.
Constructors
DataGridViewColumnGroupCollection(dataGrid)
Initializes a collection owned by the specified grid.
| Name | Type | Description |
|---|---|---|
| dataGrid | DataGridView | The grid that owns the collection. |
Properties
Item(index)
DataGridViewColumnGroup: Returns the group at the specified index.
Item(name)
DataGridViewColumnGroup: Returns the group with the specified name, or null when it is not found.
List
IList: Returns the underlying group collection.
Owner
DataGridView: Returns the grid that owns this collection.
Methods
Add(group)
Adds a group and returns its index in the collection.
| Parameter | Type | Description |
|---|---|---|
| group | DataGridViewColumnGroup | The group to add. |
Returns: Int32. The index of the added group.
Add(name, text)
Adds a new group with the specified name and text.
| Parameter | Type | Description |
|---|---|---|
| name | String | The name of the new group. |
| text | String | The text displayed in its header. |
Returns: DataGridViewColumnGroup. The new column group.
AddRange(groups)
Adds groups in the specified order. Parents may occur after their children.
| Parameter | Type | Description |
|---|---|---|
| groups | DataGridViewColumnGroup[] | The groups to add, in collection order. |
Clear()
Removes all groups and clears column group assignments.
Clear(dispose)
Removes all groups and optionally disposes them.
| Parameter | Type | Description |
|---|---|---|
| dispose | Boolean | True to dispose the removed groups. |
Contains(group)
Returns whether the collection contains the specified group.
| Parameter | Type | Description |
|---|---|---|
| group | DataGridViewColumnGroup | The group to locate. |
Returns: Boolean. True when the group belongs to this collection.
CopyTo(array, index)
Copies the groups to an array.
| Parameter | Type | Description |
|---|---|---|
| array | DataGridViewColumnGroup[] | The destination array. |
| index | Int32 | The first destination index. |
IndexOf(group)
Returns the index of a group, or -1 when it is not found.
| Parameter | Type | Description |
|---|---|---|
| group | DataGridViewColumnGroup | The group to locate. |
Returns: Int32. The zero-based index, or -1 when the group is not found.
Insert(index, group)
Inserts a group at the specified position.
| Parameter | Type | Description |
|---|---|---|
| index | Int32 | The zero-based insertion index. |
| group | DataGridViewColumnGroup | The group to insert. |
OnCollectionChanged(action, element)
Raises the CollectionChanged event.
| Parameter | Type | Description |
|---|---|---|
| action | CollectionChangeAction | The reason the collection changed. |
| element | Object | The affected group, or null for a collection refresh. |
Remove(group)
Removes a group and promotes its direct columns and child groups to its parent.
| Parameter | Type | Description |
|---|---|---|
| group | DataGridViewColumnGroup | The group to remove. |
RemoveAt(index)
Removes the group at the specified index.
| Parameter | Type | Description |
|---|---|---|
| index | Int32 | The zero-based index of the group to remove. |
SetGroupIndex(group, newIndex)
Moves a group to the specified collection index without changing its parent.
| Parameter | Type | Description |
|---|---|---|
| group | DataGridViewColumnGroup | The group to move. |
| newIndex | Int32 | The new zero-based collection index. |
Events
CollectionChanged
CollectionChangeEventHandler Occurs when a group is added, removed, or moved within the collection.