Home Forums WinForms controls Xceed Grid for WinForms Multiline edittable??? Reply To: Multiline edittable???

Xceed Support
Member
Post count: 5658

You need to set an WinTextBox (or any control) with MultiLine set to True and assign it to the CellViewerManager and the CellEditorManager. Also, if you set the AutoHeightMode to AllContent, it will adjust the row height after the end of the edition.

<code>
private void Form1_Load( object sender, EventArgs e )
{
Column col1 = new Column( “Column1” );
Column col2 = new Column( “Column2” );
gridControl1.Columns.Add( col1 );
gridControl1.Columns.Add( col2 );

for( int i = 0; i < 20; i++ )
{
Xceed.Grid.DataRow row = gridControl1.DataRows.AddNew();
row.Cells[ “Column1” ].Value = “Item ” + i.ToString();
row.Cells[ “Column2” ].Value = “MultiLine\r\nText\r\nCan\r\nBe Displayed”;

row.EndEdit();
}

WinTextBox box = new WinTextBox( EnhancedBorderStyle.None );
box.TextBoxArea.Multiline = true;
gridControl1.Columns[ 1 ].CellViewerManager = new TextViewer( box );
gridControl1.Columns[ 1 ].CellEditorManager = new TextEditor( box );

dataRowTemplate1.AutoHeightMode = AutoHeightMode.AllContent;
}
</code>

Imported from legacy forums. Posted by CharlesB (had 3022 views)