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

How to set multiple selected values to combobox

I have added combobox in xamarin form.

<SfPicker:SfComboBox x:Name="GrpBy" DropDownCornerRadius="05" FontAttributes="None" SuggestionMode="Contains" IsEditableMode="true" ShowSuggestionsOnFocus="true"

HeightRequest="40" MultiSelectMode="Token" IsSelectedItemsVisibleInDropDown="False" TextHighlightMode="MultipleOccurrence" HighlightedTextColor="Red"

                                 EnableAutoSize="True">


I retrieved the multiple selected values but now I want to set those selected values again to combobox. Please how to set multiple items to combobox as seleceted items.


3 Replies

SR Shivani Ramakrishnan Syncfusion Team January 13, 2023 12:25 PM UTC

Hi Amish,
 

 

Query: "Setting Multiple Selected Value In SfComboBox

 

We have checked the reported query and we can set mutiple selected value using SelectedItem property. We have binded the SelectedItem value using ObservableCollection. We have prepared a sample for your reference. Please get the sample from the attachments. Here is the code snippet:

 

<SfPicker:SfComboBox x:Name="GrpBy" DropDownCornerRadius="05" FontAttributes="None" SuggestionMode="Contains" IsEditableMode="true" ShowSuggestionsOnFocus="true"
 DataSource="{Binding EmployeeCollection}"  DisplayMemberPath="Name" SelectedItem="{Binding SelectedEmployee, Mode=TwoWay}" HeightRequest="40" MultiSelectMode="Token" IsSelectedItemsVisibleInDropDown="False" TextHighlightMode="MultipleOccurrence" HighlightedTextColor="Red" EnableAutoSize="True"/>


 

Please check and let us know if the problem was resolved on your side.

 

Regards,

Shivani


Attachment: ComboBoxApp1_4ff4721f.zip


AM Amish January 16, 2023 12:41 PM UTC

Madam, 

Here in attached example, you have used object model and binding. In my case I am using String List as 

public List<string> DefGrpByFld = new List<string>();

GrpBy.ComboBoxSource = DefGrpByFld;


Please check and solve accordingl



SR Shivani Ramakrishnan Syncfusion Team January 18, 2023 01:23 PM UTC

Hi Amish,

 

We have checked your requirements and prepared the sample based on your requirements. We have set the SelectedItem value using List<string> in the code behind. We have attached a sample for your reference

 

Please let us know if the problem is resolved on your side. If issue is not fixed share more details of that issue's replication

 

Regards,
Shivani


Attachment: ComboBoxApp1_5f795f2a.zip

Loader.
Up arrow icon