I understand there is no AutoGenerateColumn propery in the WinGrid (really sucks, makes more work). After databinding, I need to be able to go through a list of bound coulumns and move then appropriately based on a an array of keys. I have tried the Column SWAP functionality and it is really not functioning properly for me (logic may be wrong). Is there any snip of code IG might have to show this functionality.
Hi,
If you want to change the order in which the columns appear in the grid, I recommend that you use the InitializeLayout event of the grid.
In this event, you can get the columns in the band and set the position of each one like so:
e.Layout.Bands[0].Columns["column key"].Header.VisiblePosition = 0;
e.Layout.Bands[0].Columns["column key 2"].Header.VisiblePosition = 1;
It's important to set the VisiblePosition in order from 0 up. Because otherwise, the position of one column might alter the position of other columns.