Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TreeView Virtualization

we're trying to come up with a good way to virtualize the TreeView, the data is not really a problem because it's very light (around 16 bytes per item), the problem is that we could potentially have tens of thousands, and although the actual data would only take 160 kb of memory, the treeview items do use a lot more memory. We've tried virtualization with 3 different trees now, WPF, Infragistics and Telerik. All of them have big issues that makes them unusable for our application:

WPF TreeView: The scroll bar shows some weird behavior, jumps around a lot, changes size inconsistently, scrolling by dragging it with the mouse doesn't work properly (jumps back and forth)

Telerik: Items disappear, scroll bar is erratic too, items randomly expand collapse, styles don't work

Infragistics: Items are not virtualized at all, every item remains in memory making virtualization useless.

We've been struggling with this a couple of months now, and we haven't been able to find a good solution. Has any of you successfully implemented virtualization in a TreeView with more than 9000 items? If so, what was your strategy? Did you use third party controls? Did it work 100%?

Any suggestion extremely appreciated.

Thanks.

like image 447
Carlo Avatar asked Jan 05 '11 01:01

Carlo


2 Answers

We've used Bea Costa's Stollnitz's trick of indenting items in a ListView and using UI Virtualization to good effect.

http://www.beacosta.com/blog/?p=45

I've gotten 100,000 items in the backing ICollectionView, and it is still quite responsive to filtering, etc.

like image 174
codekaizen Avatar answered Nov 10 '22 22:11

codekaizen


We are also in a similar situation, we tried using Syncfusion tree-view and it was pathetic. As we didn't had the choice of any other 3'rd party control and no better solution was available, We finally settled with Virtualization and Load on demand(Lazy loading) together.

As in our case, generally all nodes won't be expanded at any given time. This solves the scrolling issues to some extent and makes the application usable in most of the scenarios. Although we still have our figures crossed and keep looking for a better solution.

I would like to mention here that using both Virtualization and Load on demand(Lazy loading) together have its own side effects -

Need a sample for WPF TreeView search with Virtualization and Load On Demand

.

Some samples for implementing Load on demand -

http://www.codeproject.com/KB/WPF/WPF_Explorer_Tree.aspx

http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/1eb3ed3d-6379-4353-9f35-2c0aecb885f2/

http://www.telerik.com/help/wpf/radtreeview-features-load-on-demand.html

like image 39
akjoshi Avatar answered Nov 10 '22 23:11

akjoshi