We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Update custom row style selector when changed a property

Hello,

I have a custom RowStyleSelector applied to SfDataGrid, its functionality is to change background color of certain rows based on some cell values (age value). It works well with initial values or when add new item it refresh style of all rows correctly.

However when user changes those value doesn't automatically change row color. How can I trigger the row style selector update automatic when changed a property?

Thanks, have a nice day.

Attachment: SfDatagridRowStyle_1997e854.rar

3 Replies

BR Balamurugan Rajaraman Syncfusion Team March 6, 2017 07:38 AM UTC

Hi Alexandru, 
 
Thank you for contact syncfusion support. 
 
We have analyzed you query “update custom row style when changed a property”. You can able to achieve your requirement by Calling the UpdateDataRow() method as like below.  
 
Code Sample: 
 
private void DataGridField_Loaded(object sender, RoutedEventArgs e) 
{ 
    this.DataGridField.View.RecordPropertyChanged += View_RecordPropertyChanged; 
} 
private void View_RecordPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) 
{ 
    //Here update the data row to change the style. 
    var rowindex = this.DataGridField.ResolveToRowIndex(sender); 
    this.DataGridField.UpdateDataRow(rowindex); 
} 
 
We have modified the provided sample to achieve your requirement. You can download the sample from the below link 
 
 
Please let us know if you have any query. 
 
Regards, 
Balamurugan R 



AP Alexandru Pastor Opris March 6, 2017 08:51 AM UTC

Hello Balamurugan,

Thank you a lot for the answer and the updated sample, thats exactly what we wanted, works like a charm.

Thanks again and have a nice day.


BR Balamurugan Rajaraman Syncfusion Team March 7, 2017 04:29 AM UTC

Hi Alexandru, 
 
Thanks for the update. 
 
Please let us know if you have any further assistance on this. 
 
Regards, 
Balamurugan. 


Loader.
Live Chat Icon For mobile
Up arrow icon