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

TreeView in ComboBox select item in code

4 Answers 122 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Peter Meinl
Top achievements
Rank 1
Peter Meinl asked on 03 Mar 2010, 06:49 AM
I am using the TreeView in ComboBox from Valeri
http://blogs.telerik.com/valerihristov/posts/09-08-27/treeview_in_combobox_take_3_silverlight_3_wpf_and_radcontrols.aspx

How can I set the selected item programmatically?

I tried
myTreeViewCombo.SelectedTreeViewItem = someItem
and
myTreeViewCombo.SelectedValue = someItem

The item seems to get selected, but the selection does not display in the ComboBox.

4 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 03 Mar 2010, 03:06 PM
Hello Peter,

RadTreeView cannot automatically select items by setting its SelectedItem/Value properties. To select an item you should find it and set its IsSelected property to true.

Greetings,
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
Peter Meinl
Top achievements
Rank 1
answered on 04 Mar 2010, 05:35 AM
How can I reference the TreeView inside the TreeViewComboBox from code?
0
Accepted
Valeri Hristov
Telerik team
answered on 04 Mar 2010, 02:23 PM
Hi Peter,

I guess that it would be easier if you put RadTreeView inside a RadDropDownButton:
http://demos.telerik.com/wpf/?Buttons/DropDownButton

This way you will be able to directly reference the TreeView and use it as it is on the page.

Sincerely yours,
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
Peter Meinl
Top achievements
Rank 1
answered on 04 Mar 2010, 06:48 PM
Thank you for this good suggestion.

However, with a TreeView in DropDownButton I did not know, how to find the DropDownButton the TreeView belongs too on TreeView.SelectionChanged (I create many DropDownButtons dynamically in code).

Thus I gave up on trees and use 2 ComboBoxes instead.
Tags
ComboBox
Asked by
Peter Meinl
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Peter Meinl
Top achievements
Rank 1
Share this question
or