Skip to main content
A newer version of this page is available. .

GridControl.Bands Property

Gets a collection of the GridControl‘s bands.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v20.2.dll

NuGet Packages: DevExpress.WindowsDesktop.Wpf.Grid.Core, DevExpress.Wpf.Grid.Core

Declaration

public ObservableCollectionCore<GridControlBand> Bands { get; }

Property Value

Type Description
DevExpress.Xpf.Core.ObservableCollectionCore<GridControlBand>

A collection of the GridControl‘s bands.

Remarks

The GridControl stores its bands in the Bands collection. This collection’s methods allow you to add new and remove existing bands. The GridControlBand objects are individual bands. You can access bands by an index.

<dxg:GridControl.Bands>
    <dxg:GridControlBand Header="Customer">
        <dxg:GridColumn FieldName="Name"/>
    </dxg:GridControlBand>
    <dxg:GridControlBand Header="Information">
        <dxg:GridColumn FieldName="City"/>
        <dxg:GridColumn FieldName="Visits"/>
        <dxg:GridColumn FieldName="Birthday"/>
    </dxg:GridControlBand>
</dxg:GridControl.Bands>

The following code sample sorts the GridControl‘s data agains the specified band’s column:

public partial class MainWindow : Window {
    public MainWindow() {
        ...

        grid.SortBy(grid.Bands.Single(b => b.Header.ToString() == "Information").Columns.Single(c => c.FieldName == "Visits"));
    }
}

Note

You cannot set the Bands and the GridControl.Columns properties at the same time.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Bands property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also