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
Hi Chris,
Okay, that makes sense. I did my testing with just some regular string columns.
puckstopper_37 said:1) Does the use of cellmultiline preclude the use of any embedded editor assignment?
Not necessarily. It depends on each individual editor and it's support (or lack thereof) for multiline. I am fairly sure that the Masked editor does not have any multiline support. There are no editors that support both masking and multiline.
puckstopper_37 said: 2) If not, is it the specific use of a UltraMaskedEdit that prevents the cellmultiline behavior? 3) If not, is there a property I need to set on the UltraMaskedEdit instance that will allow for the CellMultiLine to work?
2) If not, is it the specific use of a UltraMaskedEdit that prevents the cellmultiline behavior?
3) If not, is there a property I need to set on the UltraMaskedEdit instance that will allow for the CellMultiLine to work?
See #1.
Another update to my question / problem.
Doing more digging specifically on the column I'm interested in seeing the wrapped text, I find that for that column we are setting the EditorControl to a UltraMaskedEdit component. When I comment out the code that assigns the editor to the column, the cell data wraps automatically when CellMultiLine is set to true.
I'm going to continue digging but if someone could answer the following before I figure it out, it'd be very much appreciated:
1) Does the use of cellmultiline preclude the use of any embedded editor assignment?
Thanks again.
Hi Mike. Thanks for the response.
The first thing I tried on this project was setting the CellMultiLine property to true (in fact I set it true everywhere I could find, just to be safe, meaning on the band and each individual column). However that didn't seem to have any affect, my columns with data longer than the cell were still appearing with the elipses but were not multiline.
After searching the forums, I found this thread:
http://community.infragistics.com/forums/p/3789/19585.aspx
Where you replied to a similar topic:
That being said, after your reply this morning I created a new project where I inserted a simple UltraGrid with a few test rows of data, set CellMultiLine to true, and I'm indeed seeing my data automatically wrap without any return characters.
So I guess I should revise my initial question instead to ask: Is there any setting (or anything else) that could potentially override the CellMultiLine property set to true?
Thanks!
puckstopper_37 said: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.
Did you try this out? I just tried it and it wraps just fine without any return characters.