Home Forums WinForms controls Xceed Grid for WinForms Conditional formatting Reply To: Conditional formatting

User (Old forums)
Member
Post count: 23064

You can use the ValueChanged event on DataCell to do this, which will work both at startup and on existing rows.

e.g.:

private void Form1_Load( object sender, EventArgs e )

{

    dataRowTemplate1.Cells[

“SupplierID” ].ValueChanged += new EventHandler( Form1_ValueChanged );

}

void Form1_ValueChanged( object sender, EventArgs e )

{

    DataCell cell = sender as DataCell;

    if( cell != null )

    {

        if( ( int )cell.Value == 3 )

        {

            cell.ForeColor =

Color.DeepPink;

        }

    }

}

 

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