Home Forums WinForms controls Xceed Grid for WinForms Virtual Mode and AddingDataRow Reply To: Virtual Mode and AddingDataRow

User (Old forums)
Member
Post count: 23064

Exactly, a StyleSheet should do the job.  Here is more information from the help documentation on how to use a StyleSheet.

If this is not what you are looking for, you could also use the Paint event on the DataRowTemplate, and use the event handler to change the color of the row.

e.g.:

private void Form1_Load( object sender, EventArgs e )

{

    dataRowTemplate1.Paint += new GridPaintEventHandler( dataRowTemplate1_Paint );

}

void dataRowTemplate1_Paint( object sender, GridPaintEventArgs e )

{

    Xceed.Grid.DataRow row = sender as Xceed.Grid.DataRow;

    if( row != null )

    {

        ReadOnlyDataRowList rowList = gridControl1.GetSortedDataRows( true );

        if( row.Index > 0 )

        {

            if( rowList[ row.Index – 1 ].BackColor == Color.Aqua )

                row.BackColor = Color.Beige;

            else

            row.BackColor =

Color.Aqua;

        }

        else

            row.BackColor =

Color.Aqua;

    }

}

 

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