Put TreeView in a ComboBox in win forms?

3 posts, 0 answers
  1. Joel Kraft
    Joel Kraft avatar
    92 posts
    Member since:
    Jan 2004

    Posted 30 Jan 2009 Link to this post

    I was wondering if it's possible to use a TreeView as the drop-down of a combo box in win forms like you can in ASP.NET?
  2. Deyan
    Deyan avatar
    2147 posts

    Posted 02 Feb 2009 Link to this post

    Hello Joel,

    Thanks for your question.

    It is possible to create a custom control which shows a custom pop up window. Take a look at the following code snippet:

    RadTreeView treeView = new RadTreeView(); 
    RadTreeNode treeNode = new RadTreeNode("Node 1"); 
    RadTreeNode childNode = new RadTreeNode("Child of 1"); 
    RadTreeNode childNode2 = new RadTreeNode("Child 2 of 1"); 
    RadTreeNode treeNode1 = new RadTreeNode("Node 1"); 
    RadTreeNode childNode1 = new RadTreeNode("Child of 1"); 
    RadTreeNode childNode12 = new RadTreeNode("Child 2 of 1"); 
    treeView.MinimumSize = new Size(100, 350); 
    treeView.ThemeName = "ControlDefault"
    RadHostItem radHostItem = new RadHostItem(treeView); 
    this.radComboBox1.ComboBoxElement.DropDownMinSize = new Size(310, 400); 

    I am using a regular RadTreeView control and a RadHostItem instance which hosts the RadTreeView. After that I am adding the RadHostItem to the Items collection of the RadComboBox.

    Note that due to some issues within the RadHostItem you will have to set the MinimumSize property of the RadTreeView and the DropDownMinSize property of the RadComboBox. The DropDownMinSize of the RadComboBox should be bigger than the RadTreeView's.

    I hope this will help you to achieve the desired behavior.

    Do not hesitate to write back if you need further assistance.

    Kind regards,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Stefan
    Stefan avatar
    2911 posts

    Posted 22 Mar 2011 Link to this post

    Hello Joel Kraft,

    I am glad to inform you that in Q1 2011 we have introduced a major upgrade of RadTreeView control, which is now virtualized and fully customizable. Feel free to download the latest release and try it out. For more information on our latest release refer to this blog post.
    Best wishes,
    the Telerik team
Back to Top