0
votes

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

gridview

3

3 Answers

0
votes

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..

0
votes

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

0
votes

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;
    }
}