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

TreeView in a ComboBox

24 Answers 457 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Rogério
Top achievements
Rank 1
Rogério asked on 02 Apr 2009, 06:25 PM
Hello,

I'd like to use some kind of TreeView in a ComboBox.
I already checked post TreeView in a ComboBox dropdown using RadControls for Silverlight
but the sample application does not work with Q1 2009 controls!

Could you help me on some kind of solution for my problem?

Thanks.

Regards,
Rogério

24 Answers, 1 is accepted

Sort by
0
Accepted
Tihomir Petkov
Telerik team
answered on 03 Apr 2009, 09:31 AM
Hello Rogério,

I am attaching an updated version of the example. I simplified the code a bit and tested it against the latest version of the control. Let me know if you have any problems with it.

Best wishes,
Tihomir Petkov
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Rogério
Top achievements
Rank 1
answered on 03 Apr 2009, 09:42 AM
Hello,

It seams to work well.

Thanks.

Regards,
Rogério
0
NS
Top achievements
Rank 1
answered on 28 Apr 2009, 07:23 AM
Hi,
Do you have an example how this can be done trough codebehind completely ?
My Hierarchicaldatatemplate, radcombobox and radtreeview are declared in XAML, but I would like to know how to databind a List that is filled trough an async call in codebehind to the radcombobox and radtreeview.

Thanks,
Nicolas
0
Miroslav
Telerik team
answered on 28 Apr 2009, 11:46 AM
Hi Nicolas,

In the example the ItemsSource is set in Xaml, but that just helps the Design time. In fact, you can leave everything as it is and just set the ItemsSource whenever you have it, like after an async call to a web service.

You may also have to change the DataTemplates so that they will bind to the correct properties of your ViewModels (the items  that you will be in the ItemsSource collection).

Otherwise, there is no need to recreate all this in codebehind.

Regards,
Miroslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
yelong
Top achievements
Rank 1
answered on 04 Jun 2009, 10:30 PM
When testing the sample code, if I re-click the last clicked item in RadTreeView, it will give me a wrong selecteitem. Looks it returns all expanded items in the treeview.

Could you please help to check it?

I also want to know why it fires RadComboBox's SelectionChanged event when just changing the selecteditem in RadTreeView.

Thanks,

Yelong


0
Valeri Hristov
Telerik team
answered on 05 Jun 2009, 11:23 AM
Hello Yelong,

I suppose you are talking about the sample in my blog post, mentioned in the first message in this thread.

RadComboBox.SelectionChanged event is fired every time the control selection changes. The attached behavior ComboBoxExtensions sets the SelectedItem property of RadComboBox every time the SelectedItem of RadTreeView is changed, hence the SelectionChanged event is raised.

I was unable to reproduce the problem with the wrong selection of the treeview, could you provide more details about it?

Regards,
Valeri Hristov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
yelong
Top achievements
Rank 1
answered on 05 Jun 2009, 05:27 PM
Hi Valeri,

Thanks for your reply. 

it is the  screen capture .

Yelong
0
Valeri Hristov
Telerik team
answered on 08 Jun 2009, 02:46 PM
Hi Yelong,

I am afraid that the link you provided is wrong. Could you please, open a new support ticket and attach a simple application that demonstrates the problem? You may also attach the screenshot there.

All the best,
Valeri Hristov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
yelong
Top achievements
Rank 1
answered on 08 Jun 2009, 04:33 PM
Sorry, I provided a wrong live. Please check this.

http://cid-4074ce3c69ce2d01.skydrive.live.com/self.aspx/.Public/1.zip

The application I used is just the sample you provide here.

Thanks

Yelong
0
Valeri Hristov
Telerik team
answered on 11 Jun 2009, 11:53 AM
Hi yelong,

Is there any chance that you are using the first approach described in my blog post? If you use the second one, that changes the control template of RadComboBox you will get the proper behavior.

Best wishes,
Valeri Hristov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
yelong
Top achievements
Rank 1
answered on 11 Jun 2009, 04:31 PM

I just re-download the sample from the link above. It still works as what I described. Maybe the link is not correct.

But as the sample demonstrates, I implement the feature in my app with no problem.

Thank you very much.

Yelong
0
Alan
Top achievements
Rank 2
answered on 29 Jun 2009, 01:48 PM
I just downloaded the sample from this post and I am seeing the same behavior as yelong.

On the second combobox, if I click on the same sub-item twice in a row, the selected item shows all items in the tree.  Is there a fix for this?
0
Valeri Hristov
Telerik team
answered on 06 Jul 2009, 01:34 PM
Hi Alan,

Strange... My example application contains only one combobox. Am I missing something?

I attached the ZIP file that is attached to the blog post, is it the same as the one you downloaded?

Best wishes,
Valeri Hristov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Alan
Top achievements
Rank 2
answered on 06 Jul 2009, 01:45 PM
Valeri,

I downloaded the example posted in this forum (treeincombo-updated.zip), by Tihomir, and it has two combo boxes.  The first showing the standard behavior, and the second showing the tree-view inside the combo box.

However, I just downloaded your sample and I'm getting similar behavior.  Just perform the following steps:

1) Run your sample
2) Select the combo box drop down (don't select a parent item)
3) Click the tree expander to expand one parent
4) Select a child element

No item appears in the drop down. 

In your example, once one parent is selected, then it seems you can select a child element on the next subsequent selection.  However, if a child is already selected in the combo box, it prevents you from changing the selection to a different child.

Tihomir's example has a different issue in that selection a child shows all elements in the tree (see Yelong's screenshot).
0
Valeri Hristov
Telerik team
answered on 06 Aug 2009, 10:01 AM
Hello Alan,

I will create a new blog post about putting TreeView into ComboBox right after the service pack release next week. I want to use the latest and greatest Silverlight 3 version of the controls, that will introduce some changes in the XAML organization in the control assemblies, hence the delay.

Greetings,
Valeri Hristov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Vadim Dmitriev
Top achievements
Rank 1
answered on 26 Sep 2009, 04:12 PM
Hello,

Updated example posted by Tihomir Petkov in April works fine with Q1 but seems doesn't work any more wirh Q2 2009.
Tree view is being dropped down nicely but selection never appears in Combo selection box.
I tried to set combobox explicitly, bind combo text using converter, bind combo selected item and  set selected item.
I also tried to use combo SelectionBoxItemTemplate.

Could you please help me with this?

Thank you
Vadim
0
Nikolay
Telerik team
answered on 01 Oct 2009, 11:10 AM
Hi Vadim Dmitriev,

Thanks for your report. We actually introduced some changes in the RadComboBox control and we will have to properly update the example to address these changes. Once we do this, we will follow up with you.

All the best,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Valeri Hristov
Telerik team
answered on 05 Oct 2009, 01:32 PM
Hello Vadim,

Please, check my blog post for more information:
http://blogs.telerik.com/blogs/posts/09-08-27/treeview_in_combobox_take_3_silverlight_3_wpf_and_radcontrols.aspx

I think that I have somewhere an example for setting the selection in RadTreeView, let me know if you need it.

Greetings,
Valeri Hristov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
iramz
Top achievements
Rank 1
answered on 10 Feb 2010, 04:21 AM
hello hristov,

i downloaded the sample from the link above.got it working! i just want to ask about he hard coded theme (office black). i removed it but somehow, the ScrollViewer wont get my application's theme. but the PickerToggleButton can.sorry if out of topic.
0
Kiran Ghanwat
Top achievements
Rank 1
answered on 10 May 2010, 10:32 AM
Hello,
Valeri Hristov

    I have checked your latest example, it working alright.
    You have used Binaries version 2009.1.312.1020. And I am using 2010.1.422.1030
    
    Because, of this when I selects child item e.g. child 1.3 from treeview. that, does loads as "SelectedItem" in the combobox.
    but, Child item e.g. child 1 gets loaded in the combobox.
    
    but, in case of your example all works alright.
    
Please help.

Thanks,
Kiran Ghanwat
0
Valeri Hristov
Telerik team
answered on 12 May 2010, 04:04 PM
I would recommend using the new and much simpler approach to the problem, demonstrated in the following blog post:
http://blogs.telerik.com/valerihristov/posts/10-05-12/treeview_in_combobox_with_radcontrols_for_silverlight_or_wpf_final_take.aspx

Regards,
Valeri Hristov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Ryan Lege
Top achievements
Rank 1
answered on 14 May 2010, 03:17 PM
I've tried this and I'm using 2010. The Template will not bind to the Combobox. It could be that the Combobox resides in a custom Appointment form I use for Rad Scheduler Silverlight. Anybody please help!!!!
0
Marcos
Top achievements
Rank 1
answered on 04 Jun 2013, 08:33 PM
Hi,

I'm using RadControls for Silverlght version 2012.2.912.1050 but when I select one item from the RadTreeView a blurred text is shown in the RadComboBox, could someone give some help?

I have the entire solution ported to Visual Studio 2012 and SL 5 at http://sdrv.ms/ZM9oKw

Thank you very much
Marcos
0
Vladi
Telerik team
answered on 07 Jun 2013, 02:19 PM
Hi,

By design placing a TreeView control as an ItemsSource to the ComboBox control is not a built-in and supported feature and there maybe some issues. We noticed that in the uploaded project you have directly placed the TreeView control inside the RadComboBox control. As the blog post mentions:

This works, but it has one important limitation: RadComboBox cannot display the RadTreeView selected item.

The blog post describes an approach with the creation of ComboBoxExtensions and attached properties in order to make the selection of the TreeView control to be added as selection to the ComboBox. Hope this information is helpful.

Regards,
Vladi
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
ComboBox
Asked by
Rogério
Top achievements
Rank 1
Answers by
Tihomir Petkov
Telerik team
Rogério
Top achievements
Rank 1
NS
Top achievements
Rank 1
Miroslav
Telerik team
yelong
Top achievements
Rank 1
Valeri Hristov
Telerik team
Alan
Top achievements
Rank 2
Vadim Dmitriev
Top achievements
Rank 1
Nikolay
Telerik team
iramz
Top achievements
Rank 1
Kiran Ghanwat
Top achievements
Rank 1
Ryan Lege
Top achievements
Rank 1
Marcos
Top achievements
Rank 1
Vladi
Telerik team
Share this question
or