I used the Grid in the Telerik samples for WinUI C:\Program Files (x86)\Telerik\UI for WinForms Q1 2015\Examples\QuickStart\GridView\Rows\AddNewRow\Form1.cs and added the following code to get the UnitPrice in a blue font:
public Form1()
{
...
this.radGridView1.CellFormatting += new CellFormattingEventHandler(radGridView1_CellFormatting);
}
void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
GridDataCellElement dataCell = e.CellElement as GridDataCellElement;
if (dataCell != null)
{
if (dataCell.ColumnInfo.Name.ToLower() == "unitprice")
{
dataCell.ForeColor = System.Drawing.Color.Blue;
dataCell.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 0);
}
}
}
This works when the form get first loaded, but if I scroll the grid other cells also get blue randomly.
Is there something I can do about this?
Mat