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

How to set the maximum level of row nesting

1 Answer 72 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Jorge Alberto
Top achievements
Rank 1
Jorge Alberto asked on 18 Aug 2011, 01:22 PM
Hello everybody

There is a standard way to set the maximum level of row nesting? For example two or three levels max.
I hope you can help me.

Best regards
Jorge

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 23 Aug 2011, 12:03 PM
Hello Jorge Alberto,

 You would  better set the maximum level of row nesting at data level.

For example if the GridView is bound to Items=ObservableCollection<Item>, then your code may look like:

public class Item
   {
       public string Name { get; set; }
       public int Level { get; set; }
 
       private ObservableCollection<Item> items;
       public ObservableCollection<Item> Items
       {
           get
           {
               if (items == null && this.Level < 2)
               {
                   items = new ObservableCollection<Item>(from c in Enumerable.Range(0, 10) select new Item(this.Level + 1));
               }
 
               return items;
           }
       }
 
       public Item(int level)
       {
           Name = "Name " + DateTime.Now.Ticks;
           Level = level;
       }
   }
<telerik:RadTreeListView ItemsSource="{Binding}" >
            <telerik:RadTreeListView.ChildTableDefinitions>
                <telerik:TreeListViewTableDefinition ItemsSource="{Binding Items}"></telerik:TreeListViewTableDefinition>
            </telerik:RadTreeListView.ChildTableDefinitions>
</telerik:RadTreeListView>

Let me know in case you have any further questions.


Greetings,
Didie
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
TreeListView
Asked by
Jorge Alberto
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or