Randolph Randolph - 4 months ago 40
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:

| 1 |
| O2 |

Any help is sincerely appreciated.


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");