This is a migrated thread and some comments may be shown as answers.

TreeView in Combobox

11 Answers 924 Views
ComboBox and ListBox (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Axel
Top achievements
Rank 1
Axel asked on 10 Aug 2011, 12:31 PM
Hello,
I would like to have a TreeView element as a selection in a combobox.
And this control should be embedded in a RadCommandbar.

Such an example, I've already found at the following link:

"http://www.telerik.com/community/forums/aspnet/combobox/placing-single-treeview-inside-combobox-dropdown.aspx"

Is there such a thing even for c#.net 2010 Windows Form ?
Thanks for any tip

11 Answers, 1 is accepted

Sort by
0
Axel
Top achievements
Rank 1
answered on 10 Aug 2011, 01:30 PM
Hello,

I found an example:

http://www.telerik.com/community/forums/winforms/combobox-and-listbox/treeview-in-dropdown.aspx

Can someone tell me why I can not find Radcombobox?
Used in this example.

Thank you


0
Axel
Top achievements
Rank 1
answered on 10 Aug 2011, 01:59 PM
Anyone who can read is the clear advantage.

Habs found
0
Stefan
Telerik team
answered on 11 Aug 2011, 03:27 PM
Hello Axel,

Thank you for contacting us.

I am not quite sure if you resolved your inquiry or not. However, RadComboBox is still part of our suite. This control is now obsolete and will be removed from our suite in a future release.

If I understand correctly, you want to add RadTreeView control in RadDropDownList. If this is your case, please refer to the attached project. 

I hope this helps.
 
Kind regards,
Stefan
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Josue
Top achievements
Rank 1
answered on 08 Dec 2011, 05:56 AM
Hello Stefan,

I've implemented the functionality as per the example you provided in a usercontrol, but I would like the dropdown control to close when the user clicks outside the control (for example in the form that contains the usercontrol); the standard dropdown control just do that.
I've tried with the user control events itself as well with the dropdown and treeview events(leave, lostfocus, etc..) but it does not seem to work, is it possible to achieve that behaviour with these implementation of the treeview in the dropdown?

Thanks.
0
Jack
Telerik team
answered on 12 Dec 2011, 12:31 PM
Hi Josue,

Thank you for asking.

When using the code from the previous post in this thread, RadDropDownList will close when clicking outside the popup just as you require. If this does not help, please send us your solution. We will investigate it in detail and we will try to find a proper solution.
 
Best wishes,
Jack
the Telerik team

Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

0
Stanley
Top achievements
Rank 1
answered on 23 Apr 2012, 03:16 PM
Hi Telerik,

I have tested your source code in Visual Studio 2010.
But I have some question on Treeview in Combobox.

Q1: It cannot work when I set DropDownStyle to DropDownList. How to block user key in?

Q2: Is possible auto resize when expanding in the big tree?

Refer picture from attachment.
Thanks in advance.
0
Jack
Telerik team
answered on 26 Apr 2012, 02:03 PM
Hello Stanley,

Directly to your questions:
1. You can set the ReadOnly property for the text box hosted in RadDropDownList. Consider the code snippet below:
((TextBox)this.radDropDownList1.DropDownListElement.TextBox.TextBoxItem.HostedControl).ReadOnly = true;

2. It is not possible to resize RadTreeView automatically in this scenario. However, you can add a sizing grip that will allow the user to change popup size manually. Here is a sample:
this.radDropDownList1.DropDownSizingMode = SizingMode.UpDownAndRightBottom;

Do not hesitate to contact me if you have further questions.

All the best,
Jack
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Stanley
Top achievements
Rank 1
answered on 27 Apr 2012, 02:17 AM
Hi Telerik

Ans 1: working perfect :)

Ans 2: After resize manually, the list box disappear. Or can I set width? maybe 500.
Please refer Youtube link below. It captured by me.
http://www.youtube.com/watch?v=8btNb64_pms 

Note: My telerik version is 2012.1 321 

Thank You
0
Jack
Telerik team
answered on 30 Apr 2012, 01:47 PM
Hi Stanley,

You can prevent the popup from closing by handling the PopupClosing event. Here is a sample:
void radDropDownList1_PopupClosing(object sender, RadPopupClosingEventArgs args)
{
    Point location = this.radDropDownList1.Popup.PointToClient(Control.MousePosition);
    RadElement element = this.radDropDownList1.Popup.ElementTree.GetElementAtPoint(location);
    if (element is SizeGripItem)
    {
        args.Cancel = true;
    }
}

You can control the drop down size by setting DropDownHeight, DropDownMinSize and DropDownMaxSize properties.

If you need further assistance, I will be glad to help.

Regards,
Jack
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Stanley
Top achievements
Rank 1
answered on 01 May 2012, 02:07 PM
Hi Telerik,

Working perfect, thanks.

Last question, how to pre-set width when PopupOpening or PopupOpened?
The code below cannot work :'(
            this.cbbItemCat.Popup.PointToClient(new Point(768, 337));
            this.cbbItemCat.Popup.ElementTree.GetElementAtPoint(new Point(337, 129));

Please refer the picture from attachment.

Thanks a million.
0
Jack
Telerik team
answered on 04 May 2012, 01:07 PM
Hi Stanley,

You can do this by setting the Popup.Size property directly. Please consider the following code snippet:
void radDropDownList1_PopupOpening(object sender, CancelEventArgs e)
{
    this.radDropDownList1.Popup.Size = new Size(500, 200);
}

I hope it helps.
 
Regards,
Jack
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
Axel
Top achievements
Rank 1
Answers by
Axel
Top achievements
Rank 1
Stefan
Telerik team
Josue
Top achievements
Rank 1
Jack
Telerik team
Stanley
Top achievements
Rank 1
Share this question
or