Back to Devexpress

GridColumn.GroupIndex Property

wpf-devexpress-dot-xpf-dot-grid-dot-gridcolumn-3177e1f7.md

latest4.8 KB
Original Source

GridColumn.GroupIndex Property

Gets or sets the column’s position among grouping columns.

Namespace : DevExpress.Xpf.Grid

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

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
[Browsable(false)]
public int GroupIndex { get; set; }
vb
<Browsable(False)>
Public Property GroupIndex As Integer

Property Value

TypeDescription
Int32

The column’s position among grouping columns. -1 if a View is not grouped by this column.

|

Remarks

To group data against a column, set its GroupIndex property to a non-negative value.

If you group data against multiple columns, the GroupIndex property specifies the group level. In the following code sample, the City column has the 1 group level, and the Visits column has the 2 group level.

xaml
<dxg:GridColumn FieldName="City" IsSmart="True" GroupIndex="0"/>
...
<dxg:GridColumn FieldName="Visits" IsSmart="True" GroupIndex="1"/>

The following code snippets (auto-collected from DevExpress Examples) contain references to the GroupIndex 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.

wpf-data-grid-process-frequent-data-updates/CS/ChunkAndOptSummariesExample/MainWindow.xaml#L27

xml
<dxg:GridColumn FieldName="Name"/>
<dxg:GridColumn FieldName="Group" GroupIndex="0"/>
<dxg:GridColumn FieldName="Sensor1"/>

wpf-data-grid-display-group-summaries/CS/DisplayGroupSummaries_CodeBehind/MainWindow.xaml#L15

xml
<dxg:GridColumn FieldName="RegistrationDate" />
<dxg:GridColumn FieldName="Married" GroupIndex="0" SortOrder="Ascending" />
<dxg:GridColumn FieldName="Age" />

wpf-data-grid-implement-custom-grouping/CS/CustomGrouping_CodeBehind/MainWindow.xaml#L15

xml
<dxg:GridColumn FieldName="LastName" />
<dxg:GridColumn FieldName="UnitPrice" SortMode="Custom" GroupIndex="0">
    <dxg:GridColumn.EditSettings>

wpf-data-grid-implement-custom-sorting/CS/CustomSorting_CodeBehind/MainWindow.xaml#L11

xml
<dxg:GridControl.Columns>
    <dxg:GridColumn FieldName="Day" GroupIndex="0" SortMode="Custom"/>
    <dxg:GridColumn FieldName="Employee"/>

wpf-data-grid-summarize-empty-cells/CS/CustomSummary_EmptyCells_CodeBehind/MainWindow.xaml#L12

xml
<dxg:GridControl.Columns>
    <dxg:GridColumn FieldName="Text" GroupIndex="0" />
    <dxg:GridColumn FieldName="Number" />

wpf-grid-prevent-expand-collapse-operations-for-group-rows/CS/Forbid_Expand_Collapse/MainWindow.xaml.cs#L13

csharp
void OnEndGrouping(object sender, RoutedEventArgs e) {
    if (grid.Columns[nameof(Invoice.Status)].GroupIndex == 0) {
        var childRow = grid.FindRowByValue(grid.Columns[nameof(Invoice.Status)], InvoiceStatus.Invalidated);

See Also

Group Rows in Code

GridColumn Class

GridColumn Members

DevExpress.Xpf.Grid Namespace