Category / Section
How to know when the order of the columns are changed in WinForms GridGroupingControl?
1 min read
Change the column order
The order of particular column changes has been identified by using the TableDescriptor.Columns.Changing and TableDescriptor.Columns.Changed event.
C#
void Columns_Changed(object sender, Syncfusion.Collections.ListPropertyChangedEventArgs e) { if (e.Action == Syncfusion.Collections.ListPropertyChangedType.Move) { string columnName = this.gridGroupingControl1.TableDescriptor.Columns[e.Index].MappingName; Console.WriteLine("Moved index", e.Index); } } void Columns_Changing(object sender, Syncfusion.Collections.ListPropertyChangedEventArgs e) { if (e.Action == Syncfusion.Collections.ListPropertyChangedType.Move) { string columnName = this.gridGroupingControl1.TableDescriptor.Columns[e.Index].MappingName; Console.WriteLine("Moving index", e.Index); } }
VB
Private Sub Columns_Changed(ByVal sender As Object, ByVal e As Syncfusion.Collections.ListPropertyChangedEventArgs) If e.Action = Syncfusion.Collections.ListPropertyChangedType.Move Then Dim columnName As String = Me.gridGroupingControl1.TableDescriptor.Columns(e.Index).MappingName Console.WriteLine("Moved index", e.Index) End If End Sub Private Sub Columns_Changing(ByVal sender As Object, ByVal e As Syncfusion.Collections.ListPropertyChangedEventArgs) If e.Action = Syncfusion.Collections.ListPropertyChangedType.Move Then Dim columnName As String = Me.gridGroupingControl1.TableDescriptor.Columns(e.Index).MappingName Console.WriteLine("Moving index", e.Index) End If End Sub
Samples: