Back to Devexpress

ColumnCollectionBase<TColumn>.AddRange(IEnumerable<TColumn>) Method

wpf-devexpress-dot-xpf-dot-grid-dot-columncollectionbase-1-dot-addrange-x28-system-dot-collections-dot-generic-dot-ienumerable-0-x29.md

latest2.7 KB
Original Source

ColumnCollectionBase<TColumn>.AddRange(IEnumerable<TColumn>) Method

Adds a range of columns to the collection.

Namespace : DevExpress.Xpf.Grid

Assembly : DevExpress.Xpf.Grid.v25.2.Core.dll

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public void AddRange(
    IEnumerable<TColumn> columns
)
vb
Public Sub AddRange(
    columns As IEnumerable(Of TColumn)
)

Parameters

NameTypeDescription
columnsIEnumerable<TColumn>

A range of columns (GridColumn / TreeListColumn / GanttColumn).

|

Remarks

The following code sample adds columns to the GridControl.Columns collection:

csharp
grid.Columns.AddRange(new List<GridColumn> {
    new GridColumn() { FieldName = "FullName" },
    new GridColumn() { FieldName = "JobTitle" }
});

Use the GridControl.Columns / TreeListControl.Columns / GanttControl.Columns property to access the control’s column collection.

The collection contains the Add and AddRange methods to add columns:

  • When you use the Add methods, each method call updates the GridControl. To improve performance of adding operations, enclose the changes within the BeginUpdate and EndUpdate method calls. In this case, the GridControl is updated after the last call.
  • When you use the AddRange method, the method call updates the GridControl after all columns are added. You do not need to enclose the changes within the BeginUpdate and EndUpdate method calls.

See Also

ColumnCollectionBase<TColumn> Class

ColumnCollectionBase<TColumn> Members

DevExpress.Xpf.Grid Namespace