I am porting from a C1 grid to this UltraGrid. One presentation I cannot seem to deal with is the following relating to the C1 grid's presentation of cell text: A cell was able to have multiple lines of text where a string had embedded newlines (essentially making the text multiline). But each line of text was then trimmed to fit the column width. The autosize rows was able to revise the row height to fit the maximum height of a cell in that row.
With the UltraGrid, I can make the grid handle multiline cells and have the row height adapt, but all the text in a cell is shown - in some cases making the cell height way too big to be usable because I really do not want to see the entire text note. I do not want all the text to show, but only that which fits into the current column width. I've spent about a day looking over the past 30-days of messages here for some clue and the only thing I have seen that could come close is OwnerDraw - which I really did not want to get into. Does anyone have any ideas on how to accomplish what I need? What I predict as a workaround without owner draw, would be to dynamically modify a cell's text when a column was re-sized keeping each line of a multiline string trimmed according to the column width and whether a button was showing in the cell. This seems rather inefficient when an internal TextTrimming property could accomplish that. I could easily alter rowheight to accomodate the maximum number of text rows within a cell for any column across the grid as this data is fixed; the grid is used only to display data, not edit or enter new data. For what it is worth,the multiple lines of text within a cell represent that the cell actually contains more than one data object. The column represents a date, and the row represents a finding. But I do not want to have multiple rows for the same finding when there are two or more observations for the date. The C1 grid's text trimming was easily able to be used to deal with this presentation. How about the UltraGrid?
Hello, I am not sure I followed the whole scenario you have describes, but you can resize the height of the row to match to the content, or set maximum “rows count” - RowSizingAutoMaxLines and hide the rest of the text.I think you can use the fallowing snipped in order to make your grid to wrap up the text in a column and allow the multiline: this.ultraGrid1.DisplayLayout.Override.RowSizingAutoMaxLines = 3; this.ultraGrid1.DisplayLayout.Bands[0].Columns[1].CellAppearance.TextTrimming = TextTrimming.EllipsisWord; this.ultraGrid1.DisplayLayout.Bands[0].Columns[1].CellMultiLine = DefaultableBoolean.True; this.ultraGrid1.DisplayLayout.Override.RowSizing = RowSizing.AutoFixed;If you wanted to resize each rwo any time its values were changed, as well as when first populated, you'd want to call " e.Row.PerformAutoSize();" in the InitializeRow event handler.I hope this helps.Sincerely,Dimi GinevaDeveloper Support EngineerInfragistics, Inc.
Thanks for the reply but that does not accomplish what I need. I already attempted that kind of treatment. Here's the problem: I have multiple lines of text assigned to a cell where the text is a single string with embedded newlines. I want to have the cell present each line of text on a new line within the cell but truncate any portion of each line that extends past the end of the column. Turning on cellmultiline with row sizing set to autofixed (or autofree) winds up expanding the row to show all of the text within the column.
Take a simple case where I have a string of "abc def ghi jkl mno^naaa bbb ccc ddd eee fff ggg" where the ^n represents the newline. This represents two lines of text in a single cell. If the column width is set at 100 pixels, then I want only the 1st portion of each line that fits within the 100 pixels to draw in the cell and the row height to be twice the height of a single row.
I am investigating using a DrawFilter using the BeforeDrawElement phase to draw my text after I have sized each row according to the maximum number of lines of text in the cells of a row. Then with the DrawFilter, I should be able to use drawtext APIs to write the text into the drawParams graphics object provided by the DrawFilter's DrawElement function. Does that approach seem the best way?
roy_medicomp said:I am investigating using a DrawFilter using the BeforeDrawElement phase to draw my text after I have sized each row according to the maximum number of lines of text in the cells of a row. Then with the DrawFilter, I should be able to use drawtext APIs to write the text into the drawParams graphics object provided by the DrawFilter's DrawElement function. Does that approach seem the best way?
Yes, I can't see any other way to do this other that using a DrawFilter. The grid always wraps the text automatically when CellMultiline is true.
I came across the same issue. Is there any resolution or patches applied since then to show in new line when the new line character has come across