shindigo
shindigo

Reputation: 1295

One data row that spans multiple DataGridView lines

In Winforms, is there a way to have a single DataGridView row span multiple lines? So that the cells of a single row can be stacked onto two lines.

Something like this:

enter image description here

Upvotes: 2

Views: 1119

Answers (1)

David Hall
David Hall

Reputation: 33143

The only "simple" way to do this is with custom painting. It still isn't entirely trivial however, and you do not get editable cells this way.

Any solution to give editable cells would require a lot of custom code.

Quoting the DataGridView Program Manager Mark Rideout from a forum discussion:

The DataGridView does not have any support for merging cells. You can custom paint content across cells, but apart from that you would have to do a lot of work and custom coding to produce merged editable cells.

That forum does contain some example code of custom painting if that will do for your requirement.

Upvotes: 2

Related Questions