What is the method for limiting the number of levels in a TreeView?
Can't seem to find anything about this.
3 Answers, 1 is accepted
0
Petar Mladenov
Telerik team
answered on 17 Apr 2012, 01:12 PM
Hello Ian,
Could you please elaborate more on your desired scenario? How do you populate your RadTreeView? Do you use HierarchicalDataTemplates? Usually the RadTreeView is the visual presentation of your hierarchical data stored in DB / business objects / ViewModels. So it is always easier to control the ViewModels and let the RadTreeView build its containers (RadTreeViewItems) automatically by configuring properly its hierarchical templates. Isn't it suitable for you to limit your ViewModels / business objects?
All the best,
Petar Mladenov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
I'm dragging the entries for the treeView in from a RadGrid and I want to limit it so that users cannot create any levels at all.
I just want to have it so that there is only ONE tree level.
How do I set this up?
Thanks.
0
Petar Mladenov
Telerik team
answered on 20 Apr 2012, 09:56 AM
Hello Ian,
In databinding scenarios, you usually provide telerik 's HierarchicalDataTemplate to the ItemTemplate of the RadTreeView. This allows you to use the ItemTemplate and the ItemsSource properties of the HierarchicalDataTemplate and create hierarchy. When not set explicitly, these properties are automatically inherited from the RadTreeView or from the parent HierarchicalCollection. The way to use only one tree level when providing a hierarchy of classes/ viewmodels is to give the ItemTemplate of the RadTreeView a simple DataTemplate.
Kind regards,
Petar Mladenov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>