This is a migrated thread and some comments may be shown as answers.

Setting a cells style during edit...on row change clears style

3 Answers 86 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 12 Jul 2013, 04:20 PM

I have a grid that we need to bold the text when the value changes...the code Im using is in the CellEditEnded event handler:

void GridView_CellEditEnded(object sender, GridViewCellEditEndedEventArgs)
{
if(e.NewData != e.OldData)
{
e.Cell.FontWeight = FontWeights.Bold;
}



This works fine...BUT when I switch rows the style goes back to its original style. My use case requires that ALL changed values remain bolded.

How can I achieve this?

Thanks,
Ron

3 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 12 Jul 2013, 05:34 PM
Hello Chris,


You may do something like the following:

private void RadGridView_CellEditEnded(object sender, Telerik.Windows.Controls.GridViewCellEditEndedEventArgs e)
       {
           if (e.NewData != e.OldData)
           {
               e.Cell.FontWeight = FontWeights.Bold;
               
           }
           e.Handled = true;
       }


Afterwards all changes for edited cells will remain, when you switch between the rows.



Regards,
Vanya Pavlova
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Chris
Top achievements
Rank 1
answered on 26 Sep 2013, 05:34 PM
This doesn't appear to be the case when row and column virtualization is true (which we need because of the large amount of data we are displaying).
0
Dimitrina
Telerik team
answered on 01 Oct 2013, 10:03 AM
Hello,

Indeed, the approach previously suggested will not work correctly with a virtualized GridView.

The best approach would be to have a property of the bound Item indicating whether the bound property has changed. Then apply a CellStyleSelector for the column(s) similar to the example in this
 help article.

I hope this helps.
 

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Chris
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Chris
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or