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

SelectedItem values not updated correctly

Thread ID:

Created:

Updated:

Platform:

Replies:

147853 Sep 25,2019 06:24 PM UTC Sep 27,2019 05:57 AM UTC Xamarin.Forms 3
loading
Tags: SfAutoComplete
SP
Asked On September 25, 2019 06:47 PM UTC


Hi,
I have a page with the SfAutoComplete control and a button. SfAutoComplete is bound to a ObservableCollection for DataSource and SelectedItem.
Clicking on the button navigates to a page with a list of items. Once the item is selected I update the ObservableCollection  for the SelectedItem with the newly added items.
I then use PopAsync to get back to the main page.
The newly added items are not visible in SfAutoComplete's selected list. I checked the OnAppearing of the main page and I can see that the ObservableCollection has the new items. It is just not displayed.

Now a slight change to the above process-
I start typing into the SfAutoComplete control and select one of the suggested items. This is added to the SfAutoComplete's selected list.
Now I click on the add button and navigate to the list view and select another item from there.
In this case the new item is added correctly.

What could be wrong?
Is there a way to manually force the SfAutoComplete to update it's SelectedItem values - I tried a few ways on the OnAppearing but it did not work.
Is there a way to refresh the SfAutoComplete's SelectedItem list manually from code behind?

Thanks!

Muneesh Kumar G [Syncfusion]
Replied On September 26, 2019 12:36 PM UTC

Hi SP,

Greetings from Syncfusion.


 
Query: Clicking on the button navigates to a page with a list of items. Once the item is selected I update the ObservableCollection  for the SelectedItem with the newly added items.

 
We have analyzed your query, but we can’t get exact scenario from this. Because list of items has not been mentioned in the next page. 
 
We have prepared a sample with SfAutoComplete and Button. And with Button Click, we have added new collection and set the SelectedItem. Please have the sample from the below link,

Sample Link: 
 

Please check with the above sample and if the mentioned scenario differs from the above, please modify the sample based on your application and update us below details.

1) Please confirm the MultiSelect mode used or not

2) Update us the platform details.
 
 
Thanks,     
Muneesh Kumar G.     
 


SP
Replied On September 26, 2019 06:06 PM UTC

Thanks. I was able to solve this using MessagingCenter and the autocomplete's SelectionChanged event.
I am using multiselect.
I am testing on Android.

Muneesh Kumar G [Syncfusion]
Replied On September 27, 2019 05:57 AM UTC

Hi SP, 
 
Thanks for the update. 
  
We are glad to know that the given solution works. Please let us know if you need any further assistance. 
 
Thanks, 
Muneesh Kumar G. 


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