TreeView is very slow with many loaded objects
See original GitHub issueDescribe the bug With many objects loaded into the tree, scrolling and general application responsiveness are negatively affected
To Reproduce Steps to reproduce the behavior:
Load many objects with hierarchy into a TreeView. Expand all expandable nodes. Testing here with 5000 entries.
Expected behavior TreeView should be able to handle many entries (possibly via virtualization?)
Desktop (please complete the following information):
Tested on Windows 10 and RHEL 8
Additional context Tree objects look like this:
public interface ITreeItem
{
public int DatabaseId { get; set; }
public bool IsExpanded { get; set; }
public bool IsChecked { get; set; }
public string Name { get; set; }
public List<string> Tags { get; set; }
}
public class TreeEndpoint : ReactiveObject, ITreeItem
{
public int DatabaseId { get; set; }
[Reactive] public bool IsExpanded { get; set; }
[Reactive] public bool IsChecked { get; set; }
[Reactive] public string Name { get; set; }
public List<string> Tags { get; set; }
}
public class TreeGroup : ReactiveObject, ITreeItem
{
public int DatabaseId { get; set; }
[Reactive] public bool IsExpanded { get; set; }
[Reactive] public bool IsChecked { get; set; }
[Reactive] public string Name { get; set; }
public List<string> Tags { get; set; }
[Reactive] public ObservableCollection<ITreeItem> Children { get; set; }
}
TreeView bindings look like this:
<TreeView Items="{Binding Items}"
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
ClipToBounds="True">
<TreeView.Styles>
<Style Selector="TreeViewItem">
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}"/>
</Style>
</TreeView.Styles>
<TreeView.DataTemplates>
<TreeDataTemplate DataType="treeDataStructures:TreeGroup"
ItemsSource="{Binding Children}">
<VirtualizingStackPanel Classes="treeListItem"
Orientation="Horizontal"
ClipToBounds="True">
<CheckBox IsChecked="{Binding IsChecked, Mode=TwoWay}">
<!-- <Interaction.Behaviors> -->
<!-- <ButtonClickEventTriggerBehavior> -->
<!-- <InvokeCommandAction Command="{Binding $parent[UserControl].DataContext.SetCheckedState}" -->
<!-- CommandParameter="{Binding}"/> -->
<!-- </ButtonClickEventTriggerBehavior> -->
<!-- </Interaction.Behaviors> -->
</CheckBox>
<TextBlock Foreground="Red"
Text="{Binding Name}" />
</VirtualizingStackPanel>
</TreeDataTemplate>
<DataTemplate DataType="treeDataStructures:TreeEndpoint">
<VirtualizingStackPanel Classes="treeListItem"
Orientation="Horizontal"
ClipToBounds="True">
<CheckBox IsChecked="{Binding IsChecked, Mode=TwoWay}"/>
<TextBlock Text="{Binding Name}" />
</VirtualizingStackPanel>
</DataTemplate>
</TreeView.DataTemplates>
</TreeView>
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (7 by maintainers)
Top Results From Across the Web
Slow expanding and collapsing TreeView nodes
1 Answer 1 ... Both TreeView and TreeViewItem do not contain IncrementalLoading behavior, so you can't make increment loading for treeview. But ...
Read more >very slow performance on big TreeView refresh
By using the load() method, the entire TreeView will be rendered again, so multiple DOM elements needs to be recreated and processed and ......
Read more >TreeView is very slow. Any performance tips?
The desktop app can populate the winforms treeview with 500,000 items and display them without any lag. The Wisej Treview cant even display ......
Read more >TreeView is extremely slow in searching/rendering
The performance is slow because TreeView renders all loaded nodes on the page. Technically, you can get full control over nodes and load...
Read more >Thread: Speed Up TreeView
Currently there are 2 things that are really slow, loading the tree when you initially start up and also doing an expand and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@SCLDGit is this for a commercial application? Would you be willing to pay for a commercial control for this? If so we might have a solution.
Something like AST or parse tree exploring. For instance, https://astexplorer.net/ but offline.