sflistview with sfpopup with grouping and multiple selection - selection is lost on subsequent popup

Hi

I'm using the sflistcontrol in a sfpopup. I'm using grouping and multi-selection in the list to get a list of filters that I then apply to a data source elsewhere (e.g. a filter picker).

Opening the popup and displaying the list works fine the first time. When closing I grab the selection from .SelectedItems. However, when I open the popup again the selection appears to be lost, or at least it doesn't show the items as 'selected' in the UI. Even if I reset the selection and reapply it when the popup opens the UI does not update - e.g. none of the items are selected even though they are included in the .SelectedItems collection.

I've created a demo of the problem in a test project, which is attached.

Thanks


Attachment: SFTestApp_1d0d98b4.zip

3 Replies

LN Lakshmi Natarajan Syncfusion Team November 24, 2021 07:26 AM UTC

Hi Aaron, 
 
Thank you for using Syncfusion products. 
 
We have checked the reported query “sflistview with sfpopup selection is lost on subsequent popup” from our side. We would like to inform you that the element loaded in the PopupView.ContentTemplate is initialized when the popup is opened. So, we suggest you to add the SelectedItems in the SfListView.Loaded event.  
 
Please refer to the following code snippets to overcome the reported scenario, 
private void listFilter_Loaded(object sender, Syncfusion.ListView.XForms.ListViewLoadedEventArgs e) 
{ 
    this.listFilter = sender as SfListView; 
 
    foreach (var item in SelectedFilters) 
    { 
        this.listFilter.SelectedItems.Add(item); 
    } 
} 
 
We have attached the tested video in the following link, 
 
Please let us know if you need further assistance. 
 
Regards, 
Lakshmi Natarajan 



AA Aaron November 24, 2021 11:43 AM UTC

Fantastic! That worked a treat. 


Thanks very much, pat yourself on the back!



LN Lakshmi Natarajan Syncfusion Team November 24, 2021 11:55 AM UTC

Hi Aaron, 
 
Thank you for the update. 
 
We are glad that our solution meets your requirement. Please let us know if you need further assistance. As always, we are happy to help you out. 
 
Lakshmi Natarajan 
 


Loader.
Up arrow icon