You can modify appearance of grid rows and cells with Header.Appearance and Column.Apperance properties. These properties change appearance of all rows and cells that are located at the same hierarchy level as the header. You can use Row.Appearance and Cell.Appearance properties to change appearance of rows and cells. Use of these properties may require allocation of a significant volume of memory.
C# | Copy |
---|---|
public void CellAppearance(Grid grid) { grid.Rows.Add(new Product()); Row row = grid.Rows[0]; //Set appearance for even and odd rows on all hierarchical levels grid.Appearance.EvenRows.BackColor = Color.Gray; grid.Appearance.OddRows.BackColor = Color.Black; //Set appearance for even and odd rows on the top hierarchical level grid.Headers[0].Appearance.EvenRows.BackColor = Color.Gray; grid.Headers[0].Appearance.OddRows.BackColor = Color.Black; //Set a back color for the cell row["Price"].Appearance.BackColor = Color.Green; } |
Back to .Net Grid HowTo topics