Hi,
I want to optimize the column widths in a UltraGrid using the following method:
foreach (UltraGridBand gridBand in table.GridControl.DisplayLayout.Bands) { gridBand.Columns[columnKey].CalculateAutoResizeWidth(PerformAutoSizeType.AllRowsInBand, false)); }
When, I have a column that has the following features, it returns always a size of 32:
- MinWidth = 8- Type: Text Cell- No text set- No header caption set- Embeddable editor has no ButtonsRight and no ButtonsLeftCan you explain, what else could make it calculate the size to 32? In my opinion the size should be 8.Best regards,
Reto
Hi Reto,
Is your grid using multiple bands or just a single band? If it's multi-band, then the column might need more space in order to account for synchronizing with the child band column. This is especially likely if this is the first visible column, since it also might need to account for the row selectors.
If that does not help, perhaps you can post a small sample project demonstrating the issue and I will be happy to take a quick look.
Hi Mike,
thanks for your answer. I am using only one band. We have built a framework around the grid, so it is not easy to send you a test script - so before creating a script, would you have any other hints?
I send you the Grid Column properties.
Regards,Reto
I'm afraid I can't think of anything else. I just tested this out in a little sample project and even without changing the MinWidth of the columns, I am getting values lower than 32.
Perhaps this is an issue of timing. In what event are you calling this code?
thanks for your support. I am calling this method from a grid menu action: Inside a PopupMenuTool and a ButtonTool on the.ToolClick event.
The method runs after all data has been bound. There should be no further processing from our side. So, I guess, there is some property or content set on the grid columns, that is not visible but changes the way of how the resizing is calculated. As there are no ButtonsRight and no ButtonsLeft tough. I am wondering what else could be the cause.
Regards,
I can't think of anything else off-hand that would enforce a width limit on the column. Can you duplicate this in a small sample project?