Version

Displaying Multi-Line Cells

  1. Before you start writing any code, you should place using/imports directives in your code-behind so you don’t need to always type out a member’s fully qualified name.

In Visual Basic:

Imports Infragistics.Win

In C#:

using Infragistics.Win;
  1. You must set the CellMultiLine property of the Column object to True.

In Visual Basic:

Me.UltraGrid1.DisplayLayout.Bands(0).Columns(1).CellMultiLine = DefaultableBoolean.True

In C#:

this.ultraGrid1.DisplayLayout.Bands[0].Columns[1].CellMultiLine = DefaultableBoolean.True;
  1. A natural implementation of the CellMultiLine property could be as follows by also setting the VertScrollBar property of the column to True.

In Visual Basic:

Me.UltraGrid1.DisplayLayout.Bands(0).Columns(1).VertScrollBar = True

In C#:

this.ultraGrid1.DisplayLayout.Bands[0].Columns[1].VertScrollBar = true;
  1. You may want to increase the DefaultRowHeight of the grid to better illustrate this sample.

In Visual Basic:

Me.UltraGrid1.DisplayLayout.Override.DefaultRowHeight = 100

In C#:

this.ultraGrid1.DisplayLayout.Override.DefaultRowHeight = 100;
  1. Place the above snippets into the InitializeLayout event of the WinGrid™.

Run the project and type into a cell on column 1.

Press the enter key for a new line.

If the contents of the cell exceed the height of the row, you can use the vertical scroll bar to view the cell contents.