We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Avoid Automatic expansion of nodes and use of Virtualization

I need to use the Treeview with data source that can contain hundreds or even thousands of nodes with levels that can drill down to a depth of 50 levels or more.
I've read the Chapter dedicated to virtualization of the source and I've implemented the IVirtualTree interface in the class I use as ItemsSource.
Unfortunately after  activating virtualization as in the sample, assigning the Items Source loaded with my data to the Treeview just blocks the UI and nothing is visible.
Eliminating the Virtualization properties the Data is shown after a Long delay when the nodes are more than a hundred.

What I'm not understanding, as said in the Subject is How to avoid the tree from expanding automatically all nodes so that the initial rendering is limited to the root node and the first level nodes and the underlying nodes are shown (and I hope rendered) only when expanded.



2 Replies

SC sabrina c. March 8, 2016 12:12 PM UTC

Ok, I have an addition to my question,
as usual Copy and Paste is nice but not always solves all problems:

I've found that my solution developed from your treeviewadv databinding sample has inside the following:

<Style TargetType="syf:TreeViewItemAdv" x:Key="itemsStyle">
	<Setter Property="IsExpanded" Value="True"/>
	<Setter Property="ImageHeight" Value="10"/>
	<Setter Property="ImageWidth" Value="10"/>
</Style>
This is why the tree is built with nodes expanded, now my question is: Seen that in my data node I've implemented the IsExpanded property of the IVirtualTree interface, is there a way to Bind the Expansion to the property in my data? Because if I simply take away the setter or set the IsExpanded value to False, the tree does not appear...
Regards
Sabrina







PB Priyanga Balasubramaniam Syncfusion Team March 9, 2016 12:10 PM UTC

Hi Sabrina,

Thank you for contacting Syncfusion Support.

We have checked reported query by creating a sample. But we were unable to reproduce the issue. In this sample we have implemented IVirtualTree interface and bound IsExpanded property to TreeViewItemAdv. For more information, please refer the sample from the below location.

Sample: Treeview_with_Virtualization

If the issue still persists, please revert with more information like detailed replication steps? It would help to proceed further.

Regards,
Priyanga B

Loader.
Up arrow icon