A request has come through for 'esthetics' that the columns of the WinGird should epxand the entire length of the WinGrid.
Right now there are about 8 columns and to the right of the column is blank white space. I would like to make the columns expand (uniformly or otherwise) so that the white space is eliminated.
Is this a possible request?
Hi,
Just use the AutoFitStyle property on the grid's DisplayLayout.
I've done this with:
this.DisplayLayout.AutoFitStyle = AutoFitStyle.ResizeAllColumns;
However it doesn't seem to be effective.
I should also mention that I have modified the grid to have a hierarchical tree view.
cstodgell said:However it doesn't seem to be effective.
What exactly do you mean by this?
Is there extra horizontal space in your grid? Or are the columns wider than the grid and therefore the grid is showing a scrollbar.
I think if the column widths are already too big for the grid, the grid will not reduce them. It only increases the width. Also note that the AutoFitStyle applies to all bands in the hierarchy, you cannot apply it on a band-by-band basis. So if your lowest-level band extends beyond the boundaries of the grid, it will not work.
The columns to not span the width of the grid meaning they have room to increase in width.
Essentially, I want the UltraGrid to behave the same way that the .net DataGridView behaves when I set the property 'AutoSizeColumnsMode' to 'Fill'.
The columns span equally the WIDTH of the DataGridView EXACTLY meaning they also do not go outside the bounds (no scroll bars).
Are you sure that all of the columns in all of the bands in the grid fit within the visible width of the grid?
Is your DataSource recursive? If so, then every band is indented a little bit, so it's possible that band 50 (or whatever) is too wide and that's why it's not working.
The other option is, of course, that something else in your code is changing or resetting AutoFitStyle after you set it.