TreeView Virtualization

会有一股神秘感。 提交于 2019-12-03 16:29:13

问题


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.


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/4600006/treeview-virtualization

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!