How to set the maximum level of row nesting

2 posts, 0 answers
  1. Jorge Alberto
    Jorge Alberto avatar
    38 posts
    Member since:
    Dec 2009

    Posted 18 Aug 2011 Link to this post

    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
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 23 Aug 2011 Link to this post

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

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top