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

Auto complete on ComboBoxAdv

The autocomplete feature of ComboBoxAdv is pretty primitive compared to that of ComboBoxAutoComplete. 

Since I need to customize the appearance of both the list items and the text portion (use different fonts/colors and images per item) I have to use ComboBoxAdv (please note that ComboBoxes derived from Sytem.Windows.Forms.ComboBox, such as ComboBoxAutoComplete, do not allow any customization of the text portion of the combobox). 

In particular I need auto complete to open a popup with matching choices for the user to select (like it does in ComboBoxAutoComplete). Instead ComboBoxAdv merely selects the first matching item in the list portion. If the list portion is closed it does not drop down by typing and even if it is already dropped down it shows all list items, not just the matching one.

Is there a way to get the autocomplete functionality of ComboBoxAutoComplete and the customization flexibility of ComboBoxAdv?


5 Replies

KJ Keerthana Jegannathan Syncfusion Team November 10, 2016 09:52 AM UTC

Hi Panayotis,   
    
Thank you for contacting Syncfusion support.    
   
We suggest you to use the ComboBoxAutoComplete for your application. Additionally, can you share the customization details you require in ComboBoxAutoComplete. Based on your update, we will let you know further on this.    
   
Regards,    
Keerthana J. 
 
 



PK Panayotis Kouvarakis November 10, 2016 10:21 AM UTC

Actually I have tried using ComboBoxAutoComplete but it does not support the required customization:
  1. Every item may have an image. The image name is one of the datasource columns and image names may be added at runtime (*). ComboBoxAutoComplete does support images in items but they are selected by index in the ImageList (instead of using the image key that could match the image name). This is doable but will require a lot of houskeeping.
  2. Each item's text color and font depends on its status as defined by another datasource column (e.g. inactive items should be grey and italic text). This is not possible as far as I can tell.
  3. Each item may have a balloon tooltip whose text is defined in another datasource column.
  4. The selected item should appear the same way inside the text box. That is: an image must be displayed inside the text box and text color and font mus match that of the selected item. As far as I know this is not possible as there is no way to customize the rendering of the text part of a standard windows combobox (on which ComboBoxAutoComplete is based). Furthermore even getting access to the text part requires using NativeWindow and P/Invoke (very dangerous if not coordinated with other usage of NativeWindow on the same HWND, which in this case is true)
  5. Hovering over the text part should show the same balloon tooltip as the one shown when hovering over the same item in the list. I guess this would be possible provided there's access to the text control through NativeWindow (see #4 above)
(*) Regarding images in items, ComboBoxAutoComplete handles them as columns and as such they appear in their own reserved space. In contrast, in ComboBoxAdv they appear inline with the text (i.e. the text is indented only when there is an image). While the way ComboBoxAutoComplete handles image rendering is generally more acceptable, in my case the ComboBoxAdv way is preferred (there may be thousands of items and only a few have images, hence the space for an image column is wasted and really looks ugly/distracting)

All in all I have tried ComboBoxAutoComplete and I must admit I am not excited working with it, it just feels so quirky.



VI Vinothini Syncfusion Team November 15, 2016 12:35 PM UTC

Hi Panayotis,

Thank you for your update.

At present there is no support for AutoComplete functionality in ComboBoxAdv and we have consider it as feature. A support incident has been created to track the status of this issue under your account. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Regards,
Vinothini.R  



PK Panayotis Kouvarakis November 15, 2016 10:33 PM UTC

Hi Vinothini,

For the record, I have since tried to temporarily work around the issue by creating a user control containing a regular TextBox and an AutoComplete attached to it. The main issue with this arrangement is the customization of each item's appearance in AutoComplete's VirtualListView. To achieve that I had to subclass VirtualListView. But since the creation of the VirtualListView is hard coded inside the AutoComplete constructor, I had to subclass AutoComplete as well and in my constructor replace VirtualListView with my subclassed version using reflection to get access the private mebmer. That, of course is by no means a proper solution, it is just a hack to quickly work around the issue (and I would certainly discourage anyone from going that route). 

However I mention this because in the future you may want to allow customizing AutoComplete by moving the creation of VirtualListView in a virtual method that can be overridden in derived classes. This would provide a lot of flexibility for customizing the popup list of AutoComplete with only minimal changes to the control itself.

Regards,
Panayotis


VI Vinothini Syncfusion Team November 16, 2016 11:32 AM UTC

Hi Panayotis,  
  
Thank you for your update.  
  
We will consider your suggestion in our feature implementation. Please followup the incident created under your account for further updates.  
  
Regards,  
Vinothini.R  


Loader.
Live Chat Icon For mobile
Up arrow icon