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

SfListView Doesnt refresh Items using MVVM

I am loading data in OnAppearing method of the page using MVVM with ObservableCollection. If I change an item in the list, it will not refresh the ui. Exact same code works using SfDataGrid. I tried Raising Property Changed on Observable collection as well but it doesnt help.If I navigate back and come back to the page again, this time I can see the changed element in my UI. it looks like without removing data, changes are not updated 




7 Replies

MK Muthu Kumaran Gnanavinayagam Syncfusion Team September 26, 2017 10:26 AM UTC

Hi Emil, 
 
Sorry for the inconvenience caused. 
 
We have checked with the reported query “View does not refresh after modifying an item in the list” from our side. Unfortunately the reported issue does not replicate at our end. Based on the provided information we have tried to replicate the issue in our sample by loading data in OnAppearing method of a Page and replaced an list item through Button action. The item gets updated in the view as expected. We have attached the working sample for your reference and you can download it from the below link. 
 
 
Could you please check with the above sample? If the issue still reproduces at your end, could you please update the below details or else modify the above sample to replicate the issue?. So that we could analyze the issue better and update an appropriate solution. 
 
  1. If you are updating any property value of the your underlying data, then your Model class should implement the INotifyPropertyChanged and raise the PropertyChanged for that property.
  2. Whether you have set AutoFitMode of SfListView as Height?
 
Please let us know If you require further assistance. 
 
Regards, 
G.Muthu Kumaran. 



EM Emil September 26, 2017 10:58 AM UTC

Hi Muthu,

it implements AutoFitMode="Height" but my Properties of the model doesnt implement RaisedOnPropertyChanged. Without doing it, it works in SfDataGrid, I wonder why it works for SfDataGrid and doesnt work for SfListView. 

thanks,


Emil



MK Muthu Kumaran Gnanavinayagam Syncfusion Team September 27, 2017 04:54 PM UTC

Hi Emil, 
 
Sorry for the inconvenience. 
 
We have checked the reported issue with SfDataGrid sample using similar scenario and the view refreshes only after implementing the INotifyPropertyChanged in the data model and raised the PropertyChanged event for each property in the data model.  So, could you please check by implementing the same at your end and if the issue still persists, please share the working SfDataGrid sample which helps us to analyze the issue better and update you an appropriate solution. 
 
Also, please find the UG documentation of SfDataGrid in which they have mentioned about implementing the INotifyPropertyChanged interface for the model class. 
 
 
Please let us know if you require further assistance. 
 
Regards, 
G.Muthu Kumaran 



JM Jairo Martins Marques replied to Muthu Kumaran Gnanavinayagam October 13, 2017 09:48 PM UTC

Hi Emil, 
 
Sorry for the inconvenience caused. 
 
We have checked with the reported query “View does not refresh after modifying an item in the list” from our side. Unfortunately the reported issue does not replicate at our end. Based on the provided information we have tried to replicate the issue in our sample by loading data in OnAppearing method of a Page and replaced an list item through Button action. The item gets updated in the view as expected. We have attached the working sample for your reference and you can download it from the below link. 
 
 
Could you please check with the above sample? If the issue still reproduces at your end, could you please update the below details or else modify the above sample to replicate the issue?. So that we could analyze the issue better and update an appropriate solution. 
 
  1. If you are updating any property value of the your underlying data, then your Model class should implement the INotifyPropertyChanged and raise the PropertyChanged for that property.
  2. Whether you have set AutoFitMode of SfListView as Height?
 
Please let us know If you require further assistance. 
 
Regards, 
G.Muthu Kumaran. 


Hi Muthu,

after update this sample project to Xamarin Forms 2.4.0.282 and SfListView to version 15.3.0.33, the project do not compile any more.

Error message:

.../Xamarin.Android.Support.v7.AppCompat/library_project_imports/res/values-v26/values-v26.xml: Error APT0000: 1: error: Error: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'. (APT0000) (Grouping.Droid)

.../Xamarin.Android.Support.Design/library_project_imports/res/values-v26/values-v26.xml: Error APT0000: 1: error: Error: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'. (APT0000) (Grouping.Droid)

Could you check, please?

Regards,

Jairo Marques



MK Muthu Kumaran Gnanavinayagam Syncfusion Team October 16, 2017 07:20 AM UTC

Hi Jairo,   
   
We have updated our sample to latest version of Xamarin.Forms(v2.4.0.282) and SfListView(v15.3.0.33). Unfortunately, we didn’t face any errors while compiling the project. For your reference, we have attached the sample link below.   
   
   
Can you please check with the attached sample whether the same issue occurs in attached sample also? If the issue persists, please clean the project by deleting the binobj folders in your solution projects.   
   
Regards,   
G. Muthu Kumaran  
 



JM Jairo Martins Marques October 16, 2017 04:49 PM UTC

Muthu,

this version works fine.

Thanks,

Jairo Marques




MK Muthu Kumaran Gnanavinayagam Syncfusion Team October 17, 2017 04:45 AM UTC

Hi Jairo, 
 
Thanks for the update. 
 
Regards, 
G.Muthu Kumaran. 


Loader.
Live Chat Icon For mobile
Up arrow icon