Xamarin SfComboBox not showing all items when opening it's drop down list

Hi all.

Not sure it this behaviour exists or not.

I need a Xamarin SfCombobox that allows me to filter any item by typing it's name, but, at the same time, once an item has been selected and I open the combo again, I want to see ALL items at the dropped down list, not only the one that was selected.

In simple words, I want SfComboBox to act the same way a Winforms SyncFusion SfComboBox works. That is, whenever you drop down the list, you have the item selected but you see all of the items, that way, I don't have to click on the "X" button to clear the selected item, but I can rapidly click on any of the items.

Thanks in advance for the help.

6 Replies 1 reply marked as answer

SS Suganya Sethuraman Syncfusion Team November 11, 2020 09:26 AM UTC

Hi Jesús,

Greetings from Syncfusion.

We have analyzed your requirement. We have achieved your requirement by setting AllowFiltering as False. When we search the item in the input field, the searching item that is placed after the drop-down height moves to the first item.

Please have the sample for your reference,

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/SfComboBox_AllowFiltering477894346

Please check the sample if it meets your requirements and let us know if you have any concerns.

Regards,
Suganya Sethuraman.

 


Marked as answer

JE Jesús replied to Suganya Sethuraman November 11, 2020 11:02 AM UTC

Hi Jesús,

Greetings from Syncfusion.

We have analyzed your requirement. We have achieved your requirement by setting AllowFiltering as False. When we search the item in the input field, the searching item that is placed after the drop-down height moves to the first item.

Please have the sample for your reference,

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/SfComboBox_AllowFiltering477894346

Please check the sample if it meets your requirements and let us know if you have any concerns.

Regards,
Suganya Sethuraman.

 


Hi Suganya,

Thank you for the help, but, unfortunally, there are a few functionalities that doesn't work just like the Winforms ComboBox counterpart, in order to text it:

Please, select any item on your combo, and next, tap again on it, you can see that you have lost the drop down list, and if you want to select another item, you must tap on the "X", that clears the selection, and brings back the list again.

This behaviour is not acceptable at all for any user that needs to do thousands of combo selections every day.

In case anyone needs the complete Winforms functionality for the Xamarin SfCombobox, here is my solution:

1. Follow this link in order to get all the text selected when tapping the combo:


2. Create the SfComboBox this way: (note the combo's declaration is "CustomComboBox", due to previous step)

     SfComboBox combobox = new CustomComboBox()
                                {
                                    StyleId = null,

                                    ShowSuggestionsOnFocus = true,
                                    ShowClearButton = true,
                                    IsEnabled = true,
                                    IsEditableMode = true,
                                    AllowFiltering = false,
                                    EnableSelectionIndicator = true,
                                    SuggestionMode = SuggestionMode.Contains,
                                    ComboBoxMode = ComboBoxMode.Suggest,
                                    NoResultsFoundText = "Lista vacía",
                                    TextHighlightMode = OccurrenceMode.MultipleOccurrence,
                                    HighlightedTextColor = Color.Red,
                                    HighlightedTextFontAttributes = FontAttributes.Bold
                                };

3. Attach to a certain combo events in order to fool the combo's behaviour, so that it works like the Winforms one (also note that my Combos are inside an InputLayout):
     
     (inputLayout.InputView as SfComboBox).Completed += ComboBox_Completed;
     (inputLayout.InputView as SfComboBox).SelectionChanged += ComboBox_SelectionChanged;
     (inputLayout.InputView as SfComboBox).DropDownOpen += ComboBox_DropDownOpen;
     (inputLayout.InputView as SfComboBox).FocusChanged += ComboBox_FocusChanged;
     (inputLayout.InputView as SfComboBox).ValueChanged += ComboBox_ValueChanged;

4. Finally, here are those combo event's definitions:

         private void ComboBox_ValueChanged(object sender, Syncfusion.XForms.ComboBox.ValueChangedEventArgs e)
        {            
            (sender as SfComboBox).AllowFiltering = true;
        }

        private void ComboBox_Completed(object sender, EventArgs e)
        {
            (sender as SfComboBox).AllowFiltering = false;
        }

        private void ComboBox_SelectionChanged(object sender, Syncfusion.XForms.ComboBox.SelectionChangedEventArgs e)
        {
            (sender as SfComboBox).AllowFiltering = false;
        }

        private void ComboBox_DropDownOpen(object sender, EventArgs e)
        {
            (sender as SfComboBox).AllowFiltering = false;
        }

        private void ComboBox_FocusChanged(object sender, FocusChangedEventArgs e)
        {
            (sender as SfComboBox).AllowFiltering = false;
        }

With these changes my Xamarin combos work the same way the Winforms ones, that is:

     - When you drop down the list, and having an item selected, this list shows all the items (a Xamarin SfCombobox by default shows only one, the item      selected).
     - I can now type into the combo and allows me to filter the list (previously it was not possible since there was only one item on the list, the selected      one).  
     - Absolutely no need to tap on the "X" in order to remove the selected item and to select another one.   
     - When tapping the combo, all the text gets selected making it possible to type something and inmediatly get the list filtered by what you typed (before,      and as stated, you gotta tap on the "X".

Best regards.


SS Suganya Sethuraman Syncfusion Team November 12, 2020 10:00 AM UTC

Hi Jesús,

Thanks for the update.

Please let us know if you need any further assistance.

Regards,
Suganya Sethuraman.
 



SS Shankar Sharma July 6, 2021 11:58 AM UTC

Xamarin SfComboboxw When I search the item in the input field, the searching item that is placed after the drop-down height moves to the first item, for seeing it ,I have to scroll up.

Thanks in advance for the help.


Regards,

Shankar



KG Kanimozhi Gunasekaran Syncfusion Team July 7, 2021 03:35 PM UTC

Hi Shankar,

We are currently validating on this and we will update the complete details on July 9, 2021. We appreciate your patience until then.

Regards, 
Kanimozhi G.



SS Suganya Sethuraman Syncfusion Team July 9, 2021 10:55 AM UTC

Hi Shankar,

Thanks for your patience.

We have analyzed the reported issue, but we were unable to reproduce the same. Sample we tried that can be download from below.

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/ComboboxSelect-1146712241

Since we are not aware of your exact application scenario, so we request you to check the issue with the attached sample and let us know whether it is reproduced or not? If the issue was not reproduced in this sample, please revert us by modifying the sample based on your application along with replication procedure or provide the sample. It will help us to provide better solution at the earliest.

Regards,
Suganya Sethuraman.
 


Loader.
Up arrow icon