Content added ontop of old content when RaisePropertyChanged

Hello,

I am having a problem working with the SfAccordion/Expander. I have ObservableCollection<ItemInfo> AccordionInfo Bound to the accordion's BindableLayout.ItemsSource, DisplayTime (string property of ItemInfo) bound to the headers label text, and Items (OberservableCollection property of ItemInfo) bound to the ItemsSource of my sfListView which is my accordionitem content.

Whenever I use RaisePropertyChanged($"AccordionInfo"), instead of clearing the old items and setting the new items to the newly changed AccordionInfo, it keeps the old items and adds the new items with new headers to the bottom of the accordion.

Example:

Accordion:
Header 1
     Item1
     Item2
Header 2
     Item 1

Then say I add an Item to header 2 and RaisePropertyChanged($"AccordionInfo"), The new accordion looks like this.

Updated Accordion:
Header 1
     Item1
     Item2
Header 2
     Item 1
Header 1
     Item1
     Item2
Header 2
     Item 1
     Item 2


My items are looking correct under each header, but not not getting rid of the old items and headers.

I will attach pictures of the xaml. Thanks!

Attachment: AccordionPic_8ba726cb.zip

11 Replies 1 reply marked as answer

SS SaiGanesh Sakthivel Syncfusion Team January 22, 2021 01:31 PM UTC

Hi Spencer,     
     
Thank you using syncfusion products.   
               
#Regarding SfAccordion holds the old items in View after updating its ItemsSource       
We have handled accordion items collection change that is add or remove child in Accordion using OnChildRemoved which is marked as obsolete 4.8.0.1451 without even marking deprecated in previous versions. As of now, we are using Xamarin forms 4.5.0.617 in our source level. We suggest you to use the Xamarin.forms 4.8.0.1364 version in sample level to overcome the reported scenario.      
Or use the same Xamarin version that Syncfusion products supports, unless you may require any other specific features of Xamarin that is available in a later release version.  This is the long recommended sustainable and efficient solution.   
    
You can refer our release notes document like here Xamarin.Forms versions that Syncfusion products upgraded. You can check the release notes for each release for information related to version upgrade.   
   
Regards,   
SaiGanesh Sakthivel  



SB Spencer Bosley January 22, 2021 09:15 PM UTC

SaiGanesh Sakthivel,

Thank you for the quick reply. I am still having trouble resolving this issue and I didn't understand what you were saying about using OnChildRemoved. 

My xamarin.forms version is 4.8.0.1687

Thank you.


LN Lakshmi Natarajan Syncfusion Team January 25, 2021 06:52 AM UTC

Hi Spencer, 
 
We would like to inform you that our implementation for collection update has now become obsolete, due to Xamarin team's change in a future version(4.8) that did not even exist when SF controls provided support to 4.5 version. 
 
Problem Description  
We have used an override method named OnChildRemoved inside our source code which when fired triggers a series of operations. This was removed by the Xamarin team all of a sudden in version 4.8.0.1451. Our source nugets comes compiled with Xamarin.Forms version 4.5.0.617. So when you install 4.8.0.1451 version or upwards to your project that has SF references, this override method we used will no longer be fired and hence the operations triggered from within that method will not be triggered too and thus results in the issue. 
 
Solution 
If you may not require any new features or fix from the Xamarin.Forms version 4.8 or higher, then you can still install a lower version than 4.8 in your application to overcome the reported issue. 
 
Please let us know if you need further assistance. 
 
Regards, 
Lakshmi Natarajan 


Marked as answer

SB Spencer Bosley January 25, 2021 02:33 PM UTC

Thank you for your help!


LN Lakshmi Natarajan Syncfusion Team January 25, 2021 03:13 PM UTC

Hi Spencer, 
 
Thank you for the update. 
 
Please let us know if you need further assistance. As always we are happy to help you out. 
 
Lakshmi Natarajan 
 

Pat pat or squeeze fondly or playfully, especially under the chin More (Definitions, Synonyms, Translation)


WW William Watterson April 22, 2021 04:31 PM UTC

Hi,

Is there any more updates on this issue?

Is there a workaround other than downgrading xamarin forms?

Thanks,
William


SB Spencer Bosley April 22, 2021 05:37 PM UTC

Hey William,

I made a workaround. Anytime the data is changed in the accordion, call a method "RemoveAccordionDuplicates". This method accesses your accordion from the code behind and compares its current items to the datasources items. Then you can remove the items from the Accordion as needed.


SB Spencer Bosley April 22, 2021 05:37 PM UTC

You will need to create a simple for loop for this method.


LN Lakshmi Natarajan Syncfusion Team April 23, 2021 03:03 PM UTC

Hi Spencer, 
 
Thank you for your valuable suggestion.  
 
Please let us know if you need any further assistance. As always we are happy to help you out. 
 
Lakshmi Natarajan 
 



SC Sagar Chopra December 15, 2021 09:37 AM UTC

Hello,

Is there a solution to this problem yet by the syncfusion.

I am facing the same issue whenever I update the ItemSource, it gets updated on top of old data.




LN Lakshmi Natarajan Syncfusion Team December 16, 2021 01:17 PM UTC

Hi Sagar, 
 
We have fixed the reported issue in version 19.1.0.63. Please update the SfAccordion package to the latest version to resolve the issue.  
 
You can refer to our release notes details for the fix, 
 
Please let us know if you need further assistance. 
 
Regards, 
Lakshmi Natarajan 


Loader.
Up arrow icon