RadTreeview Not expanding to 3rd level

2 posts, 0 answers
  1. hamish
    hamish avatar
    44 posts
    Member since:
    Jun 2007

    Posted 23 Apr 2014 Link to this post

    I have created a RADTREEVIEW in the code behind and populated with 3 levels of items :
    RadTreeViewItem parent = new RadTreeViewItem();
    tv.IsOptionElementsEnabled = true;
    tv.IsExpandOnSingleClickEnabled = true;
    parent.Header = "Parent";
    for (int i = 0; i < 6; i++)
    RadTreeViewItem child = new RadTreeViewItem();
    child.Height = 20;
    child.Header = "Child " + i.ToString();
    for (int j = 0; j < 6; j++)
    RadTreeViewItem grandchild = new RadTreeViewItem();
    grandchild.Height = 20;
    grandchild.Header = "grandChild " + j.ToString();

    When I run the project and I click on Parent it opens and shows  6 children all with the expandable icon next to them. When I child on a 'Child' however the icon changes to an 'open' icon but none of the children show - what am I missing?
  2. Petar Mladenov
    Petar Mladenov avatar
    2882 posts

    Posted 28 Apr 2014 Link to this post

    Hello Hamish,

    Setting the Height of the RadTreeViewItems breaks the logic in the MeasureOverride and the items are not drawn. If you remove the lines in which the Height is set the RadTreeViewItems from the 3rd level will be shown. Is Height of 20 a mandatory requirement in your scenario ?
    On a side note, we highly encourage you to databound your tree and not populate it on your own with creating RadTreeViewItems in XAML or code behind - this way you loose the ability to virtualize items which speeds up the performance for the tree.

    Petar Mladenov
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
  3. DevCraft banner
Back to Top