We're currently having issues getting a grid to format columns correctly.
Given a dataset loaded into an UltraGrid, executing the line
"anUltraGrid.DisplayLayout.PerformAutoResizeColumns(false, PerformAutoSizeType.VisibleRows, true);"
doesn't work as expected. Header AND Cell data is cutoff or made too short, causing wrapping. We KNOW it's possible to fit all column and header text without anything getting cut off because we accomplish it manually resizing the columns ourselves.
Here's an example of how it looks AFTER running the autoResize, a grid we can fix manually:
/community/resized-image/__size/320x240/__key/communityserver-discussions-components-files/1040/ForInfragisticsBadAutosizeExample.png
Control Settings:
/community/resized-image/__size/320x240/__key/communityserver-discussions-components-files/1040/ForInfragisticsBadAutosizeControlSettings.png
This could be a timing issue. You are only sizing the VisibleRows, so if this code is in the Form_Load, for example, it will do nothing, as no rows are visible in the grid at that point since the grid has not yet painted. It might be a simple matter of changing this code to use PerformAutoSizeType.AllRowsInBand. This is a better option, anyway, unless you have a tremendous number of rows in your grid and this therefore causes a performance hit. Or you could try moving this code to another event that occurs later. You might want to try putting this code into a button click just as a test to see if it's a timing issue.
Hey Mike,
We actually do have it on a button and that's what we've been using to test to be sure of the issue. Here's the code that gets called when we click the button (commented out code does same thing):
private void AdjustColumnWidths() { _FinishedGoodsGrid.DisplayLayout.PerformAutoResizeColumns(false, PerformAutoSizeType.VisibleRows, true); //foreach (var column in _FinishedGoodsGrid.DisplayLayout.Bands[0].Columns) { // column.PerformAutoResize(PerformAutoSizeType.VisibleRows, AutoResizeColumnWidthOptions.All); //} }
Hi Eliot,
Is there any additional code that goes along with this call? I would expect that calling PerformAutoResize would work normally if you called it in response to a button press? Please provide a sample I can run and I will figure out what's going on.