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.
Unfortunately, activation email could not send to your email. Please try again.

How to load tokens on control loading

Auto complete provides support for selecting multiple items through token representation on control loading.

 

To load tokens on control loading :

 

Step 1:   Add the required assemblies to get the view of AutoComplete.

Step 2: Set the MultiSelectMode to Token.

Step 3 : Bind the DataSource property with the SelectedItem in the SfAutoComplete.

Step 4:  In the ViewModel class create two private varaiable of Observable Collections and add the AutoComplete items in the collections.

Step 5: The items added in the collection which are binded in the SelectedItem will be selected item which are shown in token representation while control get loaded.

 

 Selected items from the suggestion list is viewed in token representation in AutoComplete.

 

The following code illustrates how to achieve this method.

 

XAML code to set Custom filter:

 

 

Code behind code:

 

 

 

Image after loading token:

 

 

 

 

 

 

Article ID: Published Date: Last Revised Date: Platform: Control:
8522 02/28/2018 03/06/2018 Xamarin.Forms SfAutoComplete
Did you find this information helpful?
Comments
Chibuta Aug 23, 2018

If I try to delete one of the selected items such pressing on the delete button of Afghanistan from this example, I get this error in android but not in iOS

Unhandled Exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index occurred.

Reply
Add Comment
You must log in to leave a comment

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.