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

How to expand many nodes

1 Answer 47 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
koala
Top achievements
Rank 1
koala asked on 18 Apr 2016, 08:17 AM

Hello,

I have the following TreeListView.

<telerik:RadTreeListView
  AutoExpandItems="{Binding IsToggleExpand}"
  IsExpandedBinding="{Binding IsExpanded, Mode=TwoWay}"

 

  ItemsSource="{Binding FolderDataView}"
  IsFilteringAllowed="True"
  SelectedItem="{Binding SelectedItem}"
 
  EnableRowVirtualization="True"
  EnableColumnVirtualization="True"
  ValidatesOnDataErrors="InEditMode"
  VirtualizingPanel.IsVirtualizing="True"
  ScrollViewer.VerticalScrollBarVisibility="Visible">

I use IsExpanded/IsExpandedBinding to open a node and I use IsToggleExpand/AutoExpandItems to open all nodes. Everything works correct.

If I reopen my Tree I have to expand all nodes of the last session. So I store the expand state when closing and use IsExpanded to open the nodes when opening. If I open many nodes it is very slow (flickering). And the ScrollViewer does not recalc its correct size. Perhaps the UI refreshes too often.

If I expand all nodes with IsToggleExpand/AutoExpandItems it is much faster and the ScrollViewer resizes correctly.

How can I improve the user experience and the performance when opening many nodes?

 

1 Answer, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 20 Apr 2016, 09:13 AM
Hello,

Thank you for the provided information and code snippets.

The problem here is that the data structure behind RadTreeListView is constructed dynamically based on the Load on Demand approach. This ensures minimal memory consumption with large hierarchies. Since the IsExpanded binding can only be evaluated on loaded items it looks as if the hierarchy is expanding runtime.

The case with AutoExpandItems is different as it directly sets all rows IsExpanded property by using RadTreeListView's ExpandAllHierarchyItems() and CollapseAllHierarchyItems() methods.

A simple solution I can offer in order to improve the user experience is to set the ScrollMode of your TreeListView to Deferred.

I hope you find this information helpful.

Regards,
Dilyan Traykov
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
TreeListView
Asked by
koala
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Share this question
or