I need to resize rows in a grid based on a single columns value. The xRow.PerformAutoSize() method seems to be sizing rows based on the longest text in any column (even if not visible). Is there a way to control this.
Example:
Column A has description
Column B has street address
I want to expand the row size to allow the entire Description to display on a row by row basis. Rows where the Description is blank still resize with .performautosize because the street address does not fit in the cell. I want to ignore the street address in this case.
Thanks in advance for any help or direction.
Hi,
PerformAutoSize on the row changes the row's height based on all of the data in the columns for that row. So... just to be clear, you are concerned here with the height of the row, and not the width of the column. Is that right? I ask because it seems a bit odd - it would seem to make more sense to adjust the width of the description column. But maybe your app is different.
Anyway, the only way I can think of to handle this would be to hide the description column (set column.Hidden = true) before you call PeformAutoSize on the row.
Yep - i need to adjust row sizes. if i adjust columns widths the text becomes one long run on sentence that requires too much scrolling. the sizing needs to happen only based on one column and not others. The hide trick seems plausible and is actually the source of my post - performautosize seems to take the hidden rows into account (a behavior i would not expect).
Additionally, i have noted that if the grid is not full (there is space at the bottom for more rows to be added) the performautosize does not expand the rows. if i squeeze the grid down so that some of the rows are clipped at the bottom then it magically works again.
Open to any suggestions. Have attached a screenshot illustrating the situation for clarity. some cells may not have any text and i want those to be minimum height while each other row expands to fit the text in the notes column.