Sorry if this is an easy question, but I'm quite new to using infragistics. I inherited an app and need to get the following handled and I'm not sure how to do it. Essentially, we have some column headers that have increased in maximum size from 50 to 100. In the event the column header is more than 50 characters long, the end user would like the text to be split over 2 lines, rather than extending the entire column header to the max size (100).
So far I the following code:
ultraGrid.DisplayLayout.Bands[0].ColHeaderLines = 2; // set the column headers to 2 lines for (int i = 0; i < ultraGrid.DisplayLayout.Bands[0].Columns.Count; i++) { string caption = ultraGrid.DisplayLayout.Bands[0].Columns.Header.Caption; if (caption.Length > 50) { caption = caption.Substring(0, 50) + linebreak + caption.Substring(50); }
// auto size the header to show all text
ultraGrid.DisplayLayout.Bands[0].Columns.PerformAutoResize( Infragistics.Win.UltraWinGrid.PerformAutoSizeType.None, true); }
Where "linebreak" is some a character the caption will interpret as a line break. Is it possible to accomplish this in this manner? Is there an alternative way I should try to get this done?
Any help appreciated.
Yes this will work with linebreak being a crlf. There is a wraptext option if you have version 5.3 (If I remember correctly) or above. However it may or may not be appropriate in your situation.
If you have any summaries autoresize tends to not account for their size properly unless fixed reecently.
Nick
Thanks for the response. I tried crlf in the caption and that doesn't seem to work as a return character. It just includes crlf in the caption text.
caption = caption.Substring(0, 50) + Environment.NewLine + caption.Substring(50);