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.
Unfortunately, activation email could not send to your email. Please try again.

Custom row style selector refresh rows based on values.

Thread ID:

Created:

Updated:

Platform:

Replies:

120502 Sep 21,2015 04:33 PM Mar 21,2016 07:13 AM WinRT 5
loading
Tags: SfDataGrid
Vasanth
Asked On September 21, 2015 04:33 PM

Hi,

I have a custom RowStyleSelector applied to SfDataGrid, its functionality is to change background color of certain rows based on some cell values. It works well with initial values. However when user changes those value doesn't automatically change row color. How can I trigger the row style selector update in those scenarios?

Thanks,
Vasanth

Jai Ganesh S [Syncfusion]
Replied On September 22, 2015 07:27 AM

Hi Vasanth,


Thank you for using Syncfusion Products.


We have analyzed your query. When changing the value at runtime the StyleSelector is not called and the style is not applied based on the changed value. However you can achieve this requirement by calling the UpdateDataRow method and also by calling the InvalidateMeasureInfo() for visual container in the CurrentCellEndEdit event.


Code Example [C#]:


void datagrid_CurrentCellEndEdit(object sender, CurrentCellEndEditEventArgs args)

  {

        var rowindex = args.RowColumnIndex.RowIndex;

        this.datagrid.UpdateDataRow(rowindex);

  }


We have also prepared a sample based on this and you can download the sample from the below location,


Sample: http://www.syncfusion.com/downloads/support/directtrac/143149/ze/SfGridDemo-1646472712


Please let us know if you need further assistance.


Thank you,

Jai Ganesh S


Vasanth
Replied On September 22, 2015 10:29 AM

Perfect, thank you!!

Jai Ganesh S [Syncfusion]
Replied On September 23, 2015 12:21 AM

Hi Vasanth,


Thank you for the update.


Please let us know if you need further assistance on this.


Thank you,

Jai Ganesh S


Gregory
Replied On March 18, 2016 11:10 AM

Hello,

How to do the same with WPF ?

Thank you.

Jayapradha S [Syncfusion]
Replied On March 21, 2016 07:13 AM

Hi Vasanth,

You can trigger the style selector when you changed the cell value by using UpdateDataRow method in WPF  like in WinRT.
Please find the sample for WPF platform from the following location,

Sample Link: http://www.syncfusion.com/downloads/support/forum/120502/ze/RowStyleSelector_WPF906788637

Please refer the below KB document to change the cell value at runtime,
KB Link: https://syncfusion.com/kb/5992/how-to-change-the-gridcell-style-at-runtime

Regards,
Jayapradha


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;