Hi,
How do you prevent the WinGrid from auto-generating columns when binding to a datasource?
Thank you
You cannot. The grid must create a column for each column in the data structure. NewColumnLoadStyle wil help yuo hide columns, but you cannot remove them or prevent them from being created.
Depending on the needs of your application, you might want to consider using UltraWinTree instead of grid. The tree can be set up to only create the columns you want. It lacks certain grid features like summaries, filtering, and grouping, though. So it's not as robust for data entry, but it's good for navigation.
instead of using
_grid.DataSource = <your source>;
you can try the following:
_grid.SetDataBinding(<your source>, null, true, true);
where the first true means "don't create new columns" and the second means "don't create new bands"