VirtualTreeView
A WPF TreeView that actually supports virtualization.
Install / Use
/learn @picrap/VirtualTreeViewREADME
VirtualTreeView
A virtualizing TreeView for .NET Framezork 4.6.2, .NET 6 and .NET 8
How to use it
It is available as a NuGet package.
The source code includes a demonstration application, where both modes (content and binding) are showed, side-by-side to traditional TreeView control.
The treeview itself
It works exactly as the original TreeView (with a lot of missing features...):
<vtv:VirtualTreeView ItemsSource="{Binding Items}">
<!-- Item style, if there is only one, can also be set using the ItemStyle property -->
<vtv:VirtualTreeView.Resources>
<!-- The important stuff here is the ItemsSource -->
<HierarchicalDataTemplate ItemsSource="{Binding Children}"
DataType="{x:Type my:ViewModels}">
<Grid>
<TextBlock Text="{Binding MyLabel}"/>
</Grid>
</HierarchicalDataTemplate>
</vtv:VirtualTreeView.Resources>
<!-- This is optional if you want to bind the IsExpanded property -->
<vtv:VirtualTreeView.ItemContainerStyle>
<Style TargetType="{x:Type vtv:VirtualTreeViewItem}">
<Setter Property="IsExpanded" Value="{Binding MyIsExpanded, Mode=TwoWay}" />
</Style>
</vtv:VirtualTreeView.ItemContainerStyle>
</vtv:VirtualTreeView>
The treeview item
If you move from an existing treeView, you'll need to copy/paste your TreeViewItem style and adapt it to vtv:TreeViewItem (usually no change is required, except removing the hierarchical part, which is generated when the control converts the tree to a list).
What does work
Currently it has only the features I needed (which is showing items and let them live); all contributors are welcome. The goal is to have a complete and extensible tree view.
- With binding,
INotifyCollectionChangedfully works, so you can dynamically change content by adding or removing elements at any point of the hierarchy.
What does not
- With binding,
INotifyPropertyChangeddoes not work at all, since the binding is partly simulated (because the view items are not generated).
How to contribute
Fork it, update it, and submit your pull requests.
Alternatively you can submit requests.
Related Skills
openhue
352.0kControl Philips Hue lights and scenes via the OpenHue CLI.
sag
352.0kElevenLabs text-to-speech with mac-style say UX.
weather
352.0kGet current weather and forecasts via wttr.in or Open-Meteo
casdoor
13.3kAn open-source AI-first Identity and Access Management (IAM) /AI MCP & agent gateway and auth server with web UI supporting OpenClaw, MCP, OAuth, OIDC, SAML, CAS, LDAP, SCIM, WebAuthn, TOTP, MFA, Face ID, Google Workspace, Azure AD
