Posts WPF Lite TreeView
Post
Cancel

WPF Lite TreeView

This post was originally published on 18 Sep 2014 at http://blogs.microsoft.co.il/iblogger/2014/09/18/wpf-lite-treeview/

I received a call from a client last week about bad performance in their WPF application. It turns out that they expected that some view that holds a tree will need to show a few tens of items BUT when they deployed it to customer site they were surprised that the amount of items was actually a few thousands.

Long story short – WPF TreeView doesn’t scale very good, trying to expand a node with thousands of sub-items can take a long time. Virtualization doesn’t work either (especially if you work with .NET framework prior to 4.5) because it makes the tree jumpy and the scrollbar out of sync.

So finally I created a TreeView replacement that uses extends ListBox  and gives the simulation of a TreeView:

1. Expanding an item adds the sub items to inner items-list
2. Collapsing an items removes the items from the inner items-list

 

The code in on GitHub so take a look: https://github.com/tamirdresher/WPFLiteTreeView

And use the Nuget package: Install-Package WPFLiteTreeView

This post is licensed under CC BY 4.0 by Tamir Dresher.

Trending Tags