Using a treeview in combobox (or autocomplete)

Hello everyone,

I am trying to implement a selection from a tree view (SfTreeView) which is integrated in a combobox (not sure if autocomplete can work as well). The idea is instead of showing the default combobox selection you see the tree view with correct highlighting and autocomplete support. So far I haven't got much success. Do you have ideas or examples how this can be achieved?

Thanks!


5 Replies

EM Elakkiya Muthukumarasamy Syncfusion Team November 25, 2021 03:11 PM UTC

Hi Iliya, 
 
Greeting from Syncfusion. 
 
We have checked your query and we understand that you are trying to load the SFTreeView control as a content of ComboBoxAdv dropdown with correct highlighting and autocomplete support. This requirement is not possible to achieve since we cannot bind the SelectedItems from Treeview to ComboBox. 
 
Regards, 
Elakkiya 



IL Iliya November 25, 2021 04:57 PM UTC

Does it make a difference that only one item can be selected from the TreeView/Combobox?
Alternatively is it possible to use autocomplete to achieve that?



EM Elakkiya Muthukumarasamy Syncfusion Team November 26, 2021 02:34 PM UTC

Hi Iliya, 

Thanks for your update. 

Query1: Does it make a difference that only one item can be selected from the TreeView/Combobox 

We have checked your query and we have prepared the custom sample to meet your requirement. n this sample we have modified the control template of ComboBoxAdv to add SFTreeView as a child of it and we bind the SFTreeView  SelectedItem to ComboBoxAdv’ s content.Please refer the sample and Screen shot for the same. 


Screen shot: 

 

Query2:It is it possible to use autocomplete to achieve that? 

We have checked your query and we would like to let you know that we could not achieve this by using AutoComplete control. 

Regards, 
Elakkiya 



IL Iliya November 26, 2021 02:52 PM UTC

This is amazing. You have recreated almost the entire component.
Unfortunately, there is one feature which I definitely need - being able to filter (something sim AutoCompleteMode="Suggest"). I can write custom filtering function for the treeview but I am not sure how to replace the button with a textbox in the template with working bindings which would support the search as described. Do you know how this can be done?



TB Thirupathi Bala Krishnan Syncfusion Team November 29, 2021 01:53 PM UTC

Hi Illiya, 
 
Thanks for the update. 
 
As we previously stated, the reported scenario is not possible to achieve since we cannot bind the SelectedItems from Treeview to ComboBox. While using ComboBoxAdv and SfTreeView, you did not perform the auto-complete operation. 
 
Meanwhile, We recommend that you follow the code changes outlined in the link provided below. In this case, we used the CollectionView Itemsource type. This article describes how to use a WPF editable ComboBoxAdv to filter dropdown items. To obtain the ComboBoxAdv text, use the ComboBoxAdv.KeyUp event and then filter the ComboBoxAdv collectionview itemsource based on the obtained ComboBoxAdv text. As a result, we recommend passing the ItemSource value as a CollectionVIew type and then implementing the custom filtering function for the treeview as described in the article below. 
 
 
Please let us know if you need any further assistance. 
 
Regards,
Thirupathi B.
 


Loader.
Up arrow icon