Skip to main content

DisplayIndex Property

Gets or sets the display position of the column relative to the other columns in the DataGrid.

Definition

Namespace: Avalonia.Controls
Assembly: Avalonia.Controls.DataGrid (in Avalonia.Controls.DataGrid.dll)

public int DisplayIndex { get; set; }

Return Value

Int32
The zero-based position of the column as it is displayed in the associated DataGrid. The default is the index of the corresponding Item(Int32) in the Columns collection.

Exceptions

ArgumentOutOfRangeExceptionWhen setting this property, the specified value is less than -1 or equal to MaxValue. -or- When setting this property on a column in a DataGrid, the specified value is less than zero or greater than or equal to the number of columns in the DataGrid.
InvalidOperationExceptionWhen setting this property, the DataGrid is already making DisplayIndex adjustments. For example, this exception is thrown when you attempt to set DisplayIndex in a ColumnDisplayIndexChanged event handler. -or- When setting this property, the specified value would result in a frozen column being displayed in the range of unfrozen columns, or an unfrozen column being displayed in the range of frozen columns.

See Also

Reference

DataGridColumn Class
Avalonia.Controls Namespace