Tuesday, April 19, 2016

Wpf TreeView that has columns, with UI Virtualization and DataVirtualization

1 comment

I'm looking for a wpf control (free or commercial). The tree should support all the regular tree view Characteristics (styles, data templates, control template, ...) and support being laid out with Columns (sort of like the Watch window in Visual Studio).

But also:

  1. Good virtualization - should support thousands of elements
  2. Built-in Data Virtualization - The loading and processing of the data is slow and could not be done all at once and on a certain order (kind of like paging)
  3. View Model support and Binding, I prefer to investigate the tree using kind of a view model instead of investigate the tree itself
  4. Built-in support for search and filtering on the data representation and then reflect the matches on the visual elements on the tree
  5. Accurate, fast scrolling and option to move to a specific element (I prefer, using the ViewModel representation of the item).

I don't want to build the tree myself, I'm looking for existing implementation with at least support for virtualization and data virtualization.

Thanks in advance!

2 Answers

Answers 1

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

The RadTreeView API supports UI Virtualization, which processes only information loaded in the viewable area, which reduces the memory footprint of the application and speeds up loading time thus enhancing additionally the UI performance

The performance of the Telerik RadTreeView control when operating with huge amount of items is significantly optimized through its load on demand feature. This mechanism lets the nodes load their child nodes as the user expands the parent by clicking on the “+” icon

The RadTreeView is a data-driven control, designed to display large amounts of hierarchical data and it does not provide searching, filtering and sorting functionality out of the box. Hence, such operations should be implemented on the data it represents. Example

Happy passover

Answers 2

The best example I've ever seen is TreeView by Josh Smith. It uses Load-On-Demand loading and has Text Search.

To include DataVirtualization you should use:

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

But be careful, Virtualization only works when the TreeView is using Binding, and not when the nodes are generated one by one in the code like 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. It is free-trial.

Or Telerik's TreeView control. It is 30 day free-trial. See their demos and you can even download and try them.

Update1:

If you have any doubts about performance TreeView by Josh Smith, then I can say about my experince:

  • I have 500 nodes and time to load these items is 0.0003982 seconds
  • I can scroll up and scroll down and there is no any freezing UI (perfect Data Virtualization)
  • Nested nodes are perfectly opened as Josh Smith uses Lazy Loading
  • All nodes can have templates. So you can set any image or design you want
  • This TreeView does not absolutely violate MVVM rules, cause it uses viewModels for TreeViewItems. It means you will not meet strange errors or exceptions if you would have TreeViewITem in your viewModel. For example, this error.

To conclude, I would like to say I am really glad that I've chosen TreeView by JoshSmith in my production application cause it is really simple to support and edit it. It has really great performance.

Photo of my TreeView:

enter image description here

If You Enjoyed This, Take 5 Seconds To Share It

1 comment:

  1. Cisco Data Virtualization
    Unified provides an enhanced collaboration experience with Cisco’s Collaboration Room End Points for a wide set of business purposes. Cisco’s Collaboration Room EndPoints gives a steady experience to the users when grouped with customer partnership, discussion solutions and integrated communication.

    ReplyDelete