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

Change GridCell style at runtime in SfDataGrid on WPF

I'm trying to change the cell style according to its contents in a SfDataGrid.
I'm using style converters, following the StylePerformanceofSfDataGrid_WPF  sample (http://www.syncfusion.com/downloads/support/directtrac/132219/ze/StylePerformanceofSfDataGrid_WPF-24357210) posted in the article

The problem I'm having is that the style does not change immediately after editing. You need to scroll up and down or resize the window to force the re-render and see the new color of the cell (you can see that in the syncfusion sample).
In https://www.syncfusion.com/kb/4186/how-to-change-the-gridcell-style-at-runtime it is explained that you need to use UpdateDataRow but that method seems not to be in WPF, but only on WinRT.

Is UpdateDataRow an extension method and I'm missing an 'using' sentence? If it is actually only in WinRT, is it any other way to trigger the style selector and refresh the cell style immediately after ending editing the cell?
Thanks in advance


3 Replies

SP Sowndaiyan Paulpandi Syncfusion Team January 18, 2016 12:40 PM UTC

Hi Fernando,

Thanks for contacting Syncfusion Support.

In SfDataGrid, the UpdateDataRow is an extension method. So we need to add the below namespace for invoke this method,

Code Example [C#]


We have prepared a sample as per your requirement and you can download the same from the below location,

Sample: http://www.syncfusion.com/downloads/support/forum/121696/ze/StyleDataGrid_WPF1731056699



CF Carlos Fernando Consigli January 23, 2016 09:20 PM UTC

Hi Sowndaiyan.

Excellent, it worked perfectly and your samples are always helpful.


AP Ashwini Paranthaman Syncfusion Team January 25, 2016 07:21 AM UTC

Hi Fernando,
Thank you for the update.
We are glad that your issue has been fixed.
Please let us know if you need any other assistance.
Ashwini P.

Live Chat Icon For mobile
Up arrow icon