DataGridView - DefaultCellStyle, rows and columns propriority
- by angelPL
Hi!
In C#, in DataGridView I want to set the BackColor property for the first row and first column. And the cell from first row and first column, should have property from first column, not row - but it does.
For example: (table 3 x 3); 'X' - property for first row, 'Y' - property for first column, 'a' - default property
should be:
Y X X
Y a a
Y a a
but is:
X X X
Y a a
Y a a
There is no matter which property I set first:
dataGridView1.Rows[0].DefaultCellStyle.BackColor = Color.Lavender;
dataGridView1.Columns[0].DefaultCellStyle.BackColor = Color.Beige;
or:
dataGridView1.Columns[0].DefaultCellStyle.BackColor = Color.Beige;
dataGridView1.Rows[0].DefaultCellStyle.BackColor = Color.Lavender;
Sorry for my english...