How to expand many nodes

2 posts, 0 answers
  1. koala
    koala avatar
    6 posts
    Member since:
    Apr 2015

    Posted 18 Apr Link to this post

    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?

     

  2. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    369 posts

    Posted 20 Apr Link to this post

    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.
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top