Wpf TreeView with columns with user interface virtualization and DataVirtualization

I am looking for wpf control (free or commercial). The tree should support all the usual tree-like characteristics (styles, data templates, management template, ...) and the support that is laid out using columns (like a viewport in Visual Studio).

But also:

  • Good virtualization - must support thousands of elements.
  • Built-in data virtualization . Downloading and processing data is slow and cannot be performed immediately and on a specific order (for example, swapping).
  • Viewing model support and bindings, I prefer to explore the tree using the view model view rather than exploring the tree itself
  • Native support for searching and filtering in the data view, and then displaying matches of visual elements on the tree
  • Accurate, fast scrolling and the ability to jump to a specific element (I prefer using the ViewModel of the element).

I do not want to create a tree myself. I am looking for an existing implementation, at least to support virtualization and data virtualization.

+5
source share
2 answers

The best control I know who can apply your requirements is Telerik RadTreeView . View the demo. Pros:

The RadTreeView API supports user interface virtualization, which only processes information loaded in the viewing area, which reduces application memory and speeds up loading time, thereby further improving user interface performance

Telerik RadTreeView's management efficiency with a huge number of items has been greatly optimized thanks to the on-demand download feature. This mechanism allows nodes to load child nodes when the user expands the parent by clicking the +

RadTreeView is a data-driven control designed to display large amounts of hierarchical data, and it does not provide search, filter, and sort functions from the box. Consequently, such operations must be performed on the data they submit. Example

+3
source

The best example I've ever seen is TreeView by Josh Smith . It uses load loading on demand and has text search.

To enable DataVirtualization , you should use:

 <TreeView VirtualizingStackPanel.IsVirtualizing = "True" VirtualizingStackPanel.VirtualizationMode = "Recycling" /> 

But be careful, Virtualization only works when TreeView uses Binding , and not when nodes are generated one after another in code, as in the following example:

 TreeViewItem rootItem = new TreeViewItem() { Header = "Item Level 0" }; for (int i = 0; i < 1000; i++) { TreeViewItem itemLevel1 = new TreeViewItem() { Header = "Item Level 1" }; itemLevel1.Items.Add(new TreeViewItem()); rootItem.Items.Add(itemLevel1); } 

Update:

You can use the DevExpress TreeList control . This is a free trial.

Or control Telerik TreeView . This is a 30 day free trial. Watch their demo and you can even download and try them.

Update1:

If you have any doubts about Josh Smith's TreeView performance, then I can say about my experience:

  • I have 500 nodes and the time to load these elements is 0.0003982 seconds.
  • I can scroll up and scroll down and there is no freezing interface ( perfect data virtualization )
  • Nested nodes are perfectly open since Josh Smith uses Lazy Loading
  • All nodes can have templates. Thus, you can set any image or design that you need.
  • This TreeView does not completely violate the MVVM rules, so it uses viewModels for TreeViewItems . This means that you will not encounter strange errors or exceptions if you had a TreeViewITem in your viewModel . For example, this error .

In conclusion, I would like to say that I am very glad that I chose TreeView by JoshSmith in my production application, because it is very easy to maintain and edit. This is really great performance.

Photo of my TreeView :

enter image description here

+2
source

Source: https://habr.com/ru/post/1245887/


All Articles