0

Anyone here knows how to accomplish this kind of rows using DevExpress GridView on WinForms?

gridview

Raktim Biswas
  • 4,011
  • 5
  • 27
  • 32
Derstine
  • 15
  • 4

4 Answers4

0

You click on GridView and then click on Theme, you can choose from this.

Hanaka
  • 119
  • 2
  • 9
  • Hi, thanks for your feedback but i ain't looking for the theme, i'm looking to change the row colors. – Derstine Jun 27 '16 at 04:01
0

I suggest you to go through documentation for the topic: Customizing Appearances of Individual Rows and Cells.

You can do this using various ways:

  1. Customizing Appearances
  2. Using the GridView.CustomDrawCell event

The GridView.RowStyle event can be handled to customize the appearance of individual rows in GridViews. To customize a specific cell's appearance, handle the GridView.RowCellStyle event instead. The GridView.RowStyle event fires before the GridView.RowCellStyle event.

Example:

using DevExpress.XtraGrid.Views.Grid;

private void gridView1_RowStyle(object sender, 
DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e) {
   GridView View = sender as GridView;
   if(e.RowHandle >= 0) {
      string category = View.GetRowCellDisplayText(e.RowHandle, View.Columns["Category"]);
      if(category == "Beverages") {
         e.Appearance.BackColor = Color.Salmon;
         e.Appearance.BackColor2 = Color.SeaShell;
      }            
   }
}

References:
Changing Row Colours on DevExpress GridView

Hope this help..

Community
  • 1
  • 1
Niranjan Singh
  • 18,017
  • 2
  • 42
  • 75
0

Here is how you would do in a DataGridView control in forms. Should be similar I assume, it has been a while since I last used DevExpress. But you should go through the DevExpress' documentation, since all of the components are very well documented.

foreach (DataGridViewRow row in dgInformation.Rows)
{
    if (some criteria here == 1234)
    {
        row.DefaultCellStyle.BackColor = Color.Goldenrod;
    }
}
Selim Balci
  • 940
  • 2
  • 11
  • 26
0

Try the following:

gridView.EnableAppearanceEvenRow = true;

Or:

gridView.EnableAppearanceOddRow = true;
George
  • 1
  • 2