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

RadTreeview Not expanding to 3rd level

1 Answer 30 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
hamish
Top achievements
Rank 1
hamish asked on 23 Apr 2014, 02:31 PM
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";
tv.Items.Add(parent);
for (int i = 0; i < 6; i++)
{
RadTreeViewItem child = new RadTreeViewItem();
child.Height = 20;
child.Header = "Child " + i.ToString();
parent.Items.Add(child);
for (int j = 0; j < 6; j++)
{
RadTreeViewItem grandchild = new RadTreeViewItem();
grandchild.Height = 20;
grandchild.Header = "grandChild " + j.ToString();
child.Items.Add(grandchild);
}

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

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 28 Apr 2014, 08:09 AM
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.

Regards,
Petar Mladenov
Telerik
 
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.
 
Tags
TreeListView
Asked by
hamish
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or