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
135
What's the best way to accomplish this?
posted

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].ColumnsIdea.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].ColumnsIdea.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.