Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1105
UltraGrid Column wrap cell text
posted

My question concerns text wrapping in UltraGrid Columns.  In previous posts I've seen replies that state the CellMultiLine property will only wrap text in a cell if the cell text contains returns or new lines.  It's the CellMultiLine property that drives whether those new line characters will be respected and placed on new lines.

I've been tasked with providing a way to wrap text in a cell without the presence of any new line or return characters.  Even without the presence of return characters, it seems like this is a function that could be accomplished.

Since CellMultiLine doesn't appear to be an option, I added a DrawFilter to the grid, trapping on the BeforeDrawForeground phase of all TextUIElement.  Then while coding the DrawElement method, I noticed that the TextUIElement has a property "WrapText" on it.  Setting that property to true accomplishes most of what I want, cell text is wrapping in columns without the need for return characters.

The remaining problem I have, however, is that the row itself is not autosizing it's height to match the height of the largest cell despite having RowSizing set to "AutoFixed" and "AutoFree" (i've tried both).  I've even tried calling .PerformAutoResize() on every row in the grid with no success.

My questions are:

1)  If CellMultiLine really is only meant to enable / disable the support of newline characters in cell data, it seems like a true "WrapText" on the column would be a natural since the behavior is already available in the TextUIElement.  Am I missing something?

2) Is there a way to amend my approach (using the drawfilter) such that every row's height (not width, that has to be user driven) is automatically resized to the largest cell value?

 

Thanks in advance.

 

Chris Rowland