DataGridView RowSpan Control painting - bug



I think I have a bug.  When the top of a control spanning multiple rows scrolls out of view, the control disappears.

To reproduce, create a DGV with a few columns and 100 rows:
dgv[1, 1].Control = new Label{ Dock = DockStyle.Fill, BackColor = Color.Red };
dgv[1, 1].Style.RowSpan = 30;

On running the red area should appear, but disappear as soon as row 1 scrolls out of view.


  • You must to post comments

Not really a bug. More like a feature. The DataGridView uses virtual scrolling to be able to handle unlimited rows and it only creates the HTML for the visible rows so when a row is of of view it simply doesn’t exist in the browser. We noticed this after the RowSpan feature was added (otherwise we would have left it out).

These are the enhancements that are coming to the DGV before the end of the year:

  • VirtualScroll property (true by default, similar to the new VirtualScroll property in the TreeView). When false the grid will render and scroll all the rows. So the trade off will be RowSpan > 1 versus large number of rows.
  • Frozen rows (top or bottom).
  • Temporary rows, this is internal and will reduce memory consumption for large data set by 80-90%.


  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.