Hi
After Editing cell values i want to resize grid columns based on cell values. my code:
foreach (UltraGridColumn col in grid.DisplayLayout.Bands[0].Columns)
{
col.PerformAutoResize();
}
When current cell value is bigger than pervious value its Grows properly but When current cell value is smaller than previous value it donot shrink, it keeps *Row Height as it is. ( Row Height - becoz Column's CellMultiline is True)
Hi,
I'm having a hard time understanding your question. How does autosizing the column relate to the height of the row? This code will never change the row height either bigger or smaller. If you want to auto-resize the rows, then you should use the PerformAutoSize method on the row.
BTW, the code you have here will only autosize the columns based on the visible cells in the grid. That is - the cells that are scrolled into view. You might want to consider using one of the other overloads of PerformAutoResize to include all of the rows.
My Code for grid rows and columns as below:
private void ultraGrid_InitializeLayout(object sender, InitializeLayoutEventArgs e){ ultraGrid.DisplayLayout.Bands[0].Columns[1].CellMultiLine = Infragistics.Win.DefaultableBoolean.True; ultraGrid.DisplayLayout.Override.RowSizing = RowSizing.AutoFree; ultraGrid.DisplayLayout.AutoFitStyle = AutoFitStyle.ResizeAllColumns; foreach (UltraGridColumn ugColumn in ultraGrid.DisplayLayout.Bands[0].Columns) { ugColumn.PerformAutoResize(); } ultraGrid.DisplayLayout.GroupByBox.Hidden = true;}
private void ultraGrid_AfterCellUpdate(object sender, CellEventArgs e){
foreach (UltraGridColumn ugColumn in ultraGrid.DisplayLayout.Bands[0].Columns) { ugColumn.PerformAutoResize(); }}
After cell update, Current cell value is larger than previous value then column size grows properly but when Current cell value smaller than previous value then column size does not shrink properly. PerformAutoResize() shrink column size to max. cell value, correct ? but its shrinks to less than max. cell value.