Professional UI Solutions
Site Map   /  Register


Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Elegant Grid Tech Support » Multiline text in column header - any way to do this without custom viewer? Collapse All
Subject Author Date
Alexander Kaay Jan 10, 2010 - 11:52 PM

Greetings -

Is there a way to enable multiline text in cells, particularly for the header. I can see how that can be implemented with a custom viewer, but then there the issue with matching to skins, etc., so I am hoping there a built-in method. Under the hood it’s just a flag to string draw function. You have similar functionality in Prof-UIs with __EGCS_EX_WRAP_TEXT attribute... Thanks!



Alexander Kaay Jan 11, 2010 - 2:26 PM

Yes, I have tried both \r\n and \n and it does not seem to work. This particular project is in VB.NET so the following code:

		    cols(i) = New Elegant.Grid.Column
		    cols(i).Width = 40
		    cols(i).HeaderText = "123" & vbLf & "456"

makes 456 disappear, but does not make it multiline nonetheless. Furthermore, it would be my preference to have automatic word wrapping rather than having to specify explicit line breaks, especially given the fact that Graphics.DrawString method can draw wrapped text into a rectangle when StringFormat.FormatFlags.NoWrap is not set. I am presuming that the grid uses that method to draw text at some point or another...

Any other suggestions?


Technical Support Jan 12, 2010 - 8:00 AM

You should increase the header’s height. 456 is not visible partially because the text is wrapped by the text area rather than not by the header cell area. The text area is smaller than header cell area.Here is how to set a 90 pixel height for header row at top:

aGridControl.RowHeaderColumn.CellStyles[typeof(Elegant.Grid.ColumnHeaderRowHeaderCellStyle)].MinimalHeight = 90;
Here is how to set a 90 pixel height for outer row header cells on left and, as a result make each grid row having at least a 90 pixels height:
aGridControl.RowHeaderColumn.CellStyles[typeof(Elegant.Grid.RowHeaderCellStyle)].MinimalHeight = 90;
Text wrapping is not supported at the moment, we plan to implement it in future releases.

Technical Support Jan 11, 2010 - 6:53 AM

Did you try "\n" to make the text multiline?

aGridControl.Columns[0].HeaderText = "123\n456";