We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to change the column order of the WinForms GridListControl?

Platform: WinForms |
Control: GridListControl
Tags: columns, ordering

Change the column orders

You can change the column orders of a GridListControl by overriding the CreateGridColumn method in GridListControl class. By using this method, you can change the order of the columns as per your requirement. In the following sample, the columns are reordered from ParentID|Integer to Interger|ParentID.


this.gridListControl1 = new reorder.MyGridListcontrol();
public class MyGridListcontrol : GridListControl
    public MyGridListcontrol() : base()
    { }
    public override void CreateGridColumn(PropertyDescriptor pd, int column)
        CurrencyManager cm = this.BindingContext[this.DataSource] as CurrencyManager;
        PropertyDescriptorCollection pdc = cm.GetItemProperties();
        if (pdc != null)
           if (column == 1)
              column = 2;
           else if (column == 2)
              column = 1;
           base.CreateGridColumn(pdc[column - 1], column);


Me.gridListControl1 = New reorder.MyGridListcontrol()
public class MyGridListcontrol : GridListControl
    public MyGridListcontrol()
    End Sub
    public override void CreateGridColumn(PropertyDescriptor pd, Integer column)
         Dim cm As CurrencyManager = TryCast(Me.BindingContext(Me.DataSource), CurrencyManager)
         Dim pdc As PropertyDescriptorCollection = cm.GetItemProperties()
         If pdc IsNot Nothing Then
            If column = 1 Then
                column = 2
            ElseIf column = 2 Then
                column = 1
            End If
            MyBase.CreateGridColumn(pdc(column - 1), column)
         End If
    End Sub
End Class

The following screenshot displays the changed column order in the GridListControl.

Change the column order for GridListControl

Figure 1: Changed Column order in the GridListControl


C#: ChangeColumnOrderInGLC

VB: ChangeColumnOrderInGLC

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile