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. Image for the cookie policy date

Get/Set selected items

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

1 Reply

MK Muneesh Kumar G Syncfusion Team 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.   
 


Loader.
Live Chat Icon For mobile
Up arrow icon