TreeView in Combobox

12 posts, 0 answers
  1. Axel
    Axel avatar
    12 posts
    Member since:
    May 2011

    Posted 10 Aug 2011 Link to this post

    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
  2. Axel
    Axel avatar
    12 posts
    Member since:
    May 2011

    Posted 10 Aug 2011 Link to this post

    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


  3. UI for WinForms is Visual Studio 2017 Ready
  4. Axel
    Axel avatar
    12 posts
    Member since:
    May 2011

    Posted 10 Aug 2011 Link to this post

    Anyone who can read is the clear advantage.

    Habs found
  5. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 11 Aug 2011 Link to this post

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

  6. Josue
    Josue avatar
    3 posts
    Member since:
    Nov 2011

    Posted 07 Dec 2011 Link to this post

    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.
  7. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 12 Dec 2011 Link to this post

    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.

  8. Stanley
    Stanley avatar
    32 posts
    Member since:
    Apr 2012

    Posted 23 Apr 2012 Link to this post

    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.
  9. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 26 Apr 2012 Link to this post

    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 >>
  10. Stanley
    Stanley avatar
    32 posts
    Member since:
    Apr 2012

    Posted 26 Apr 2012 Link to this post

    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
  11. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 30 Apr 2012 Link to this post

    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 >>
  12. Stanley
    Stanley avatar
    32 posts
    Member since:
    Apr 2012

    Posted 01 May 2012 Link to this post

    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.
  13. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 04 May 2012 Link to this post

    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 >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready