Hi Henry,
Thank you for contacting Syncfusion support,
We have analyzed your query. GridDataControl provide method Add, Remove and Insert the column at runtime. So that you can change the columns order as you want.VisibleColumn.Add() method add the columns at last position and Insert method used to insert the column at specific location. Similarly Remove and RemoveAt method works accordingly.
In attached sample we have stored the column(Col1) and we have cleared it. We have insert the column(Col1) at First position , like this you can change the column order at runtime.
Code snippet[C#]:
private void Button_Click(object sender, RoutedEventArgs e) { var column = this.syncgrid.VisibleColumns[1]; this.syncgrid.VisibleColumns.RemoveAt(1); this.syncgrid.VisibleColumns.Insert(0, column); } |
We have prepared the sample based on this and you can download it from below location,
Sample Location: GridDataControl_Sample.zip
We have a SfDataGrid control like GridDataControl. But compare to GridDataControl, SfDataGrid having a better performance and flexibility. SfDataGrid assists you to create entirely customizable and highly interactive features used to display and manipulate the huge amount of data. So, we suggest you to use SfDataGrid instead of GridDataControl.
You can also achieve the same requirement in SfDataGrid too. We have prepared a sample based on this and you can download it from below location,
Sample Location: SfDataGrid_Sample.zip
You can also refer the below documentation link to know more about SfDatagrid,
Documentation Link: http://help.syncfusion.com/ug/wpf/documents/overview6.htm
You can also refer the below comparison document between SfDataGrid and GridDataControl
Comparison Document: GridDataControl_SfDataGrid_Comparison.zip
Please let us know if you have any other queries,
Regards,
Saravanan.M