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
close icon

treeView multiselect w/comboBox

I'd like the following-A drop down combo box whose dropdown is a treeView. The tree view will support a check box for each item. More than one can be checked. Can this be done? Is there a restriction if I'm on Syncfusion 4.4.0.51? thanks, -Bruc


4 Replies

BG Bruce Gordon January 11, 2008 07:01 PM UTC

I forgot to add that I'd like the combo box to be read only. Ideally I could put my own "summary" into the combo box text area. For example if the tree view had Item1, item2, selected, then the combo box could show "item1, item2".

>I'd like the following-A drop down combo box whose dropdown is a treeView. The tree view will support a check box for each item. More than one can be checked. Can this be done? Is there a restriction if I'm on Syncfusion 4.4.0.51? thanks, -Bruc





J. J.Nagarajan Syncfusion Team January 21, 2008 07:54 PM UTC

Hi Bruce ,

You can achieve this with version 4.4.0.51. Please refer to the following sample which has Combobox with TreeView as a dropdown, in which all the items of the treeview can be checked/unchecked.

To put your own summary like, to show all the all the checkeditems in the combobox area, please use the below code.

if (this.treeViewAdv1.CheckedNodes.Count > 0)
{
string val = "";
char delimiter = '','';
foreach (TreeNodeAdv node in this.treeViewAdv1.CheckedNodes)
{
if (val.Length > 0)
val += delimiter;
val += node.Text;
}
this.comboDropDown1.Text = val;
}

Here is a sample tested with version 4.4.0.51
http://websamples.syncfusion.com/samples/Tools.Windows/F71019/main.htm

Please let me know if you have any questions.

Regards,
Nagaraj



AS Andrew Skalkin January 29, 2008 11:51 PM UTC

It'll be great if Syncfusion had such a control (the one that supports data binding, themes, etc) out-of-the-box. We have written a similar one (also, the drop-down area is resizable), but it lacks theme support.



SR SubhaSheela R Syncfusion Team February 5, 2008 06:16 AM UTC

Hi Bruce,

Thank you for using Syncfusion products.

1. Resizing
You can resize the ComboDropDown by setting SizableToolWindow to the FormBorderStyle property of the PopupContainer's PopupHost.

this.comboDropDown3.PopupContainer.PopupHost.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
// Necessary to set the host's client size every time, especially since the popup's Dock style is set to DockStyle.Fill.
if (!(this.comboDropDown3.PopupContainer.PopupHost.Size.Width >= 140))
this.comboDropDown3.PopupContainer.PopupHost.Size = new System.Drawing.Size(140, 150);
// So that the popup container will Fill the entire popup host when resized.
this.comboDropDown3.PopupContainer.Dock = DockStyle.Fill;

2. Customizing the appearance
You can change the scrollbars color by setting true to Office2007ScrollBars and also setting its ColorScheme to blue using its Office2007ScrollBarsColorScheme property. By using ForeColor property, you can change forecolor of the node text.

this.treeViewAdvDataBound1.Office2007ScrollBars = true;
this.treeViewAdvDataBound1.Office2007ScrollBarsColorScheme = Office2007ColorScheme.Blue;
this.treeViewAdvDataBound1.ForeColor = Color.Red;

3. Data Binding
You can also bind data to the TreeViewAdv in ComboDropDown. Please refer the sample available in the link below. After downloading, you can refer with TreeViewAdvDataBound_Demo folder and please let me know if it helps:

http://websamples.syncfusion.com//samples/Tools.Windows/F71019/main.htm

Regards,
Subhasheela R



Loader.
Live Chat Icon For mobile
Up arrow icon