I thought if I did this it would work, but it doesn't
private void rgv_CellEditEnded(object sender, Telerik.Windows.Controls.GridViewCellEditEndedEventArgs e)
e.Cell.Foreground = new SolidColorBrush(Colors.Yellow);
6 Answers, 1 is accepted
You can try to expose properties in your business object specifying whether it has been edited or not. Afterwards, you can define a CellStyleSelector and based on the values of those properties to change the foreground. I am attaching a sample project illustrating the suggested approach.
Please take a look at it and let me know whether it meets your requirements.
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
e.Cell.Background = new SolidColorBrush(Colors.Yellow);
It works for background but not for foreground. I'd probably just do it this way, even if it's only the background I can change.
Edit: It works for my combo box, but not for my decimal value.
On the AddingNewDataItem event, I set something in the object saying it's a new row. Then I use CellStyleSelector on the columns.
This seems to be working without having to change my object much.
I couldn't find a way to change the color of a new row without using the cellStyleSelector though. Is there an event I could use the change the foreground in those rows?
Actually, it is not recommended to work with the visual elements and their properties - as it is in this case with cells and their background/foreground properties. As the virtualization of RadGridView is turned on by default, those visual elements will be recycled and reused on scrolling. That is why I would suggest you to implement the logic with CellStyleSelector.
the Telerik team