Hi!
I have the following grid
As you can see, there is a lot of white space. So i would like to resize the form and grid automatically so that the white space dissapears.
How can i do this ?
Thanks !
Hey,
You can do this with the following property:
UltraGrid1.DisplayLayout.AutoFitStyle
Options: Infragistics.Win.UltraWinGrid.AutoFitStyle.ExtendLastColumn: Extends the last column to fill the white space.Or Infragistics.Win.UltraWinGrid.AutoFitStyle.ResizeAllColumns: Extends all columns equally to fill the white space.
Kind regards,
Michael
Thank you Michael!
I know this possibilities, but what I would preffer is resizing the form to the size of the data columns.
Hello,
You could use code like
int total = 0; foreach (var header in ultraGrid1.DisplayLayout.ColScrollRegions[0].VisibleHeaders) { total += header.Header.Column.Width; } ultraGrid1.Width = total + 25;
foreach (var header in ultraGrid1.DisplayLayout.ColScrollRegions[0].VisibleHeaders)
{
total += header.Header.Column.Width;
}
ultraGrid1.Width = total + 25;
When you have the total size of the grid you could set to desierd value
this.Width = value;
Please let me know if you have any further questions.