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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

sfListView SelectionChanged seems not firing

Thread ID:

Created:

Updated:

Platform:

Replies:

151110 Jan 31,2020 07:25 AM UTC Feb 3,2020 01:16 PM UTC Xamarin.Forms 1
loading
Tags: SfListView
Benjamin
Asked On January 31, 2020 02:17 PM UTC

it seems that the selectionchanged event of my sfListview is not firing when I select items

I have attached a simplified sample of what I am doing.

My expected final goal has not been implemented in the sample, but I wanted to achieved is, after selecting the items, user will click on the submit button, the code will take the SfListView.SelectedItems put in a List and do further processing. 

Attachment: TestProject_c6cd955d.zip

Chandrasekar Sampathkumar [Syncfusion]
Replied On February 3, 2020 01:16 PM UTC

Hi Benjamin, 

 Thank you for using Syncfusion products. 

 We have checked the reported query from our end. The mentioned issue occurs because SfCheckBox will take the focus so that SfListView's SelectionChanged event will not be fired. So you can use StateChanged event in SfCheckBox to achieve your requirement. Please refer the following code snippet for more reference, 

Xaml: 

<buttons:SfCheckBox Text="{Binding ContactName}"  

                                                        StateChanged="SfCheckBox_StateChanged" 

                                                        IsChecked="{Binding IsDone}"> 

buttons:SfCheckBox> 

 

C#: 

 

   private void SfCheckBox_StateChanged(object sender, Syncfusion.XForms.Buttons.StateChangedEventArgs e) 

        { 

            var checkBox = (sender as SfCheckBox).BindingContext as Contacts; 

            lblSelectedAssignee.Text += "selectionChanged|"; 

            ObservableCollection <object> items = new ObservableCollection<object>(); 

            if (e.IsChecked == true) 

            { 

                listAssignee.SelectedItems.Add(checkBox); 

                items = listAssignee.SelectedItems; 

            } 

            else if(e.IsChecked == false) 

            { 

                listAssignee.SelectedItems.Remove(checkBox); 

                items = listAssignee.SelectedItems; 

            } 

            for (int i = 0; items.Count > ii++) 

            { 

                var item = items[i] as Contacts; 

                item.IsDone = true; 

                selectAssignee += "" + item.ContactName + "|"; 

                if (i == items.Count - 1) 

                    lblSelectedAssignee.Text += lblSelectedAssignee.Text + item.ContactName + " . "; 

                else 

                    lblSelectedAssignee.Text += lblSelectedAssignee.Text + item.ContactName + " , "; 

            } 

            entryAssignee.Text = selectAssignee; 

        } 


We have modified the sample based on your requirement and we have attached the sample in the following link,
 

Sample Link : SfListViewSample 

Please check the sample and let us know if you still facing the same issue? If not, please modify our sample and revert us back. It will be helpful for us to check on it and provide you the solution at the earliest.  

Regards, 

Chandrasekar Sampathkumar 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon