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

DataGrid ItemSource does not show updates to item property changes

I have an sfdatagrid that has it's itemsource set to an observablecollection. All works ok except that I want the grid to reflect programatic changes to the properties of items in the collection. I tried removing and then re-adding the item at the same position but the change was not reflected in the grid. Then I extended the ObservableCollection class with MyObservableCollection<t> where T : INotifyPropertyChanged. When I set this new class as the grids itemsource the app crashes. No debug error in VS, it just shuts down.

How can I get the sfdatagrid to reflect changes to item properties in the ObservableCollection ItemSource?

Regards
Steve

5 Replies

VP Vimal Prabhu Manohkaran Syncfusion Team July 11, 2016 06:03 AM UTC

HI Steve,

Thanks for contacting Syncfusion Support. 

Please refer the following KB link to achieve your requirement of "Making the SfDataGrid reflect the changes in ObservableCollection"
 

KB link : https://www.syncfusion.com/kb/6167/how-to-edit-a-column-in-sfdatagrid
 
Please let us know whether this meets you requirements. In case if it fails to meet your requirements kindly revert us with a sample reproducing the issue.

Regards,
Vimal Prabhu



AP Ashwini Paranthaman Syncfusion Team July 11, 2016 06:38 AM UTC

From: Steve Kaminski
Sent: Monday, July 11, 2016 2:34 AM
To: Syncfusion Support
Subject: Re: Syncfusion support community forum 124913, DataGrid ItemSource does not show updates to item property changes, has been updated.
 

This does not look like it will solve my problem. I am not editing cells in the UI but I am changing the values of the underlying datamodel. When I do change the value of the datamodel I expect the grid to show that change in the grid but it does not. 

Do you have an example where the datamodel is changed and the grid reflects those changes?  



VP Vimal Prabhu Manohkaran Syncfusion Team July 12, 2016 01:27 PM UTC

Hi Steve,

Thanks for the update. We were unable to reproduce the reported issue "DataGrid ItemSource does not show updates to item property changes". We have prepared a sample based on your requirements. In the sample choose the 'Update Data' from the picker to update values in the grid.

Sample Link :  http://www.syncfusion.com/downloads/support/forum/124913/ze/CRUD816795788

Regards,
Vimal Prabhu


ST Steve July 13, 2016 01:29 AM UTC

Hi,

It turns out that the error was in my code. My model did not have a private member reflecting the public property and so when the property changed it triggered the property change handler in an infinite loop. Ouch! Sorry rookie error. The good news is that the grid now reflects updates to the underlying model. Sorry for the inconvenience.

Steve


VP Vimal Prabhu Manohkaran Syncfusion Team July 13, 2016 05:42 AM UTC

Hi Steve,

Thank you for the update. Please let us know if you need any other assistance. 

Regards,
Vimal Prabhu

Loader.
Up arrow icon