Back to Devexpress

ColumnView.ColumnPositionChanged Event

windowsforms-devexpress-dot-xtragrid-dot-views-dot-base-dot-columnview-56b43561.md

latest2.9 KB
Original Source

ColumnView.ColumnPositionChanged Event

Allows you to respond to changing a column’s position within the View.

Namespace : DevExpress.XtraGrid.Views.Base

Assembly : DevExpress.XtraGrid.v25.2.dll

NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Property Changed")]
public event EventHandler ColumnPositionChanged
vb
<DXCategory("Property Changed")>
Public Event ColumnPositionChanged As EventHandler

Event Data

The ColumnPositionChanged event's data class is EventArgs.

Remarks

The column whose position has been changed is specified by the event’s sender parameter. To get the column’s position among visible columns in the Column Header Panel, use the GridColumn.VisibleIndex property.

The ColumnPositionChanged event also fires in the following cases:

csharp
using DevExpress.XtraGrid.Columns;

private void gridView1_ColumnPositionChanged(object sender, EventArgs e) {
    GridColumn column = sender as GridColumn;
    MessageBox.Show(column.VisibleIndex.ToString());
}
vb
Imports DevExpress.XtraGrid.Columns

Private Sub gridView1_ColumnPositionChanged(ByVal sender As Object, ByVal e As EventArgs) _
    Handles gridView1.ColumnPositionChanged
    Dim column As GridColumn = TryCast(sender, GridColumn)
    MessageBox.Show(column.VisibleIndex.ToString())
End Sub

To identify the column’s position within the group panel, use the GridColumn.GroupIndex property.

See Also

VisibleIndex

GroupIndex

ColumnView Class

ColumnView Members

DevExpress.XtraGrid.Views.Base Namespace