Home Forums WinForms controls Xceed Grid for WinForms Changing Background Color of Row according to data on initial Form Load. Reply To: Changing Background Color of Row according to data on initial Form Load.

User (Old forums)
Member
Post count: 23064

Use the AddingDataRow event, and set the color accordingly in the event handler.

e.g:

private void Form1_Load(object sender, EventArgs e)

{

    gridControl1.AddingDataRow +=

new AddingDataRowEventHandler(gridControl1_AddingDataRow);

}

void gridControl1_AddingDataRow( object sender, AddingDataRowEventArgs e )

{

    if( ( int )e.DataRow.Cells[ “ShipperID” ].Value == 2 )

        e.DataRow.BackColor =

Color.Gray;

}

Imported from legacy forums. Posted by André (had 366 views)