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

Get/Set selected items

Thread ID:

Created:

Updated:

Platform:

Replies:

145686 Jul 3,2019 02:37 PM UTC Jul 4,2019 07:19 AM UTC Xamarin.Forms 1
loading
Tags: SfComboBox
Nathan Jeynes
Asked On July 3, 2019 02:40 PM UTC

Hi I would like to know how to get the selected items and set the selected items of this control. I cant find any documentation to cover this.  I am simply binding a List in c# code behind.  

Just to add this is using the Multi Select in token mode

Muneesh Kumar G [Syncfusion]
Replied On July 4, 2019 07:19 AM UTC

Hi Nathan, 
 
Greetings from Syncfusion. 
 
We have checked the requirement in SfComboBox control, and you can achieve this by using SelectedItem API. We have prepared a sample based on your requirement. Please have the sample from the below link, 
 
 
Code Snippet: 
   
XAML: 

<combobox:SfComboBox     x:Name="comboBox" 
                                     HeightRequest="50"
                                     MultiSelectMode="Token"
                                     DataSource="{Binding Colors}"
                                     SelectedItem="{Binding SelectedItem}"
                                     Watermark="Select an Item"
                                     SelectionChanged="Handle_SelectionChanged"
                                     ComboBoxMode="Suggest">
 </combobox:SfComboBox> 
 
C#: 
void Handle_SelectionChanged(object sender, Syncfusion.XForms.ComboBox.SelectionChangedEventArgs e)
        {
            ObservableCollection<object> SelectedItems = new ObservableCollection<object>();
            SelectedItems = (sender as SfComboBox).SelectedItem as ObservableCollection<object>;
        } 
 
Please check with the sample and let us know if you have any concern. 
 
Regards, 
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