Hi. I am binding a typesafe collection to a grid. I am not creating any columns at design time – the columns are being created dynamically when the DataSource property is set. How does the grid decide the order in which these columns are displayed, and how can I set my own preferred order?
Imported from legacy forums. Posted by kh (had 3306 views)
To set the <b>visible</b> order of the columns, you can use the <b>VisibleIndex</b> property of the Column objects. Like this:<code>myGrid.Columns[“Column1”].VisibleIndex = 0; myGrid.Columns[“Column2”].VisibleIndex = 1; myGrid.Columns[“Column3”].VisibleIndex = 2;</code>
Imported from legacy forums. Posted by Tommy (had 171 views)
cheers tommy. i kind of hoped i could do it without hardcoding the grid to a particular bound object. i.e. the object itself determines the column order. i can think of many ways to hack this, but hoped for an elegant (e.g. attribute based) solution.
Imported from legacy forums. Posted by kh (had 331 views)
Kai. Thanks, but I’m not binding a DataTable. I’m binding a typed collection and the grid does not appear to use e.g. the order in which child object properties are defined. This is possibly not an Xceed grid issue but a more general databinding issue.
I’m not losing any sleep over this one, just wondered if anyone knew how this works
Imported from legacy forums. Posted by kh (had 4607 views)