Randolph Randolph - 1 month ago 11
C# Question

Insert Line Break into XtraGrid Cells

I'm creating a calendar view for an employee's shift schedule.

enter image description here

Basically, what I need to do is replace the " - " in the Cells with a line break so that the cell would be shown as:

|--------|
|Saturday|
|--------|
| 1 |
| O2 |
----------


Any help is sincerely appreciated.

Answer

You can use RepositoryItemMemoEdit as your ColumnEdit. It allows to use line breaks in cells.
Here is example:

var edit = new RepositoryItemMemoEdit();

foreach (GridColumn column in gridView1.Columns)
    column.ColumnEdit = edit;

gridView1.SetRowCellValue(1, gridView1.Columns[0], "2\n02");
Comments