Hi,
How do you prevent the WinGrid from auto-generating columns when binding to a datasource?
Thank you
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"
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.
You could try setting the grid.DisplayLayout.NewColumnLoadStyle to Hide to see if that solves your problem.
-Matt