Randolph Randolph - 1 year ago 91
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.

Answer Source

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");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download