Supress Alternating Row Style for Specific Data Grid Column?

D

Daniel Manes

My DataGridView is set up like this:
* Main row background color = white
* Alternating row background color = light gray

I also have a read-only (non-editable) column I want to show up as
solid dark gray (i.e., no alternating row colors), but it shows up as
alternating dark/light gray.

Is there any way to get around this?

Thanks,

-Dan
 
D

Daniel Manes

Never mind...turned out I needed to use CellTemplate.Style.BackColor
instead of DefaultCellStyle.BackColor.

-Dan
 
T

Thomas Holloway

You can subscribe to the DataGridView's RowsAdded event. Each time a row is
added, you can set the style of the desired column. This would be a fast fix
to that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top