UD Table Column Header Wrap Text to 2 rows

Is there a way to make the header row of a UD table appear two rows high so that the column caption (label) can wrap to show the whole header name while being a narrower column?

You can easily change the column width (by dragging the edges), but I want to change the column header height. How can I do this?


using Infragistics.Win.UltraWinGrid;

//if needed
var ultGrid = (EpiUltraGrid)csm.GetNativeControlReference(“The Guid here”);

ultGrid.DisplayLayout.Override.WrapHeaderText = DefaultableBoolean.True;

This works for the body of the UD table, but it does not change the table Header Row (the column labels do not wrap and extend the height of the column header row).
My column name is Product Description (but the word Description is cut off and not displayed).


How about this:
uGrid.DisplayLayout.Bands[0].Columns[“ColKeyHere”].CellMultiLine = DefaultableBoolean.True;


According to Mike @ Ingragistics:
CellMultiLine only affects the cells. For the column header, you will want to do something like this:

e.Layout.Override.WrapHeaderText = DefaultableBoolean.True;

Did you try turning off UseAppStyling?

I did try with UseAppStyling set to False (it changed the font, but still did not allow header row wrap).

This is the text I am using:
e.Layout.Override.WrapHeaderText = Infragistics.Win.DefaultableBoolean.True;

If I use just DefaultableBoolean.True, then I get an error.
I am pretty new at this, so thank you for your patience and help.

You are doing it right, not sure why it isnt giving us the intended effect.

Thanks Chris,
This is where I have inserted the line.

private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
UltraGridLayout layout = e.Layout;
UltraGridBand band = layout.Bands[0];

		e.Layout.Override.WrapHeaderText = Infragistics.Win.DefaultableBoolean.True;

        band.ColHeaderLines = 3;
        band.Columns["Customer Name"].Header.Caption = "Customer " + Environment.NewLine + "Name";

Perhaps I dropped it in the wrong spot.

Try adding this line

band.GroupHeaderLines = 2;

I do not use the WrapHeaderText override but I do use a newline in the caption, like you are, and it displays a two line column heading.


I may want to do this in the future.

Where is

ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)

called from, and what passed as the arguments?

I could certainly live with fixing the Header Line height (to 2 or 3), but it would be nice for users that like to customize their view, to adjust the column width and have the Header line expand to what is required.

I tried the band.GroupHeaderLines = 2; and unfortunately, my Header Line height remains at 1.


Calvin, just select your grid in the Event Wizard and find that event and add it.

1 Like

Is this only for custom controls (Grids I added)? Or can it be used to tweak builtin controls?

You can do it with existing controls too. You just have to get a reference (csm.GetNativeControlReference) and then wire up (and deregister) the event manually.


myGridRef.InitializeLayout += myInitializeLayout;

myGridRef.InitializeLayout -= myInitializeLayout;

//the proc
void myInitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)


Here is the using statements and the start of my code for the grid.

using Infragistics.Win;  //for DefaultableBoolen.True
using Infragistics.Win.UltraWinGrid;


private void GRID_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
		e.Layout.Override.HeaderClickAction = HeaderClickAction.SortMulti;

		UltraGridBand band = this.GRID.DisplayLayout.Bands[DATATABLE];
		band.ColHeaderLines = 2;
		band.GroupHeaderLines = 2;

I then went and added the WrapHeaderText, removed the new lines in the Caption and that worked, it wrapped the text in the 2 lines of the header (thanks for the tip Chris).


1 Like