Giter VIP home page Giter VIP logo

virtualtreeview's Introduction

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, INotifyCollectionChanged fully works, so you can dynamically change content by adding or removing elements at any point of the hierarchy.

What does not

  • With binding, INotifyPropertyChanged does 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.

virtualtreeview's People

Contributors

picrap avatar quintushr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

virtualtreeview's Issues

BringIntoView

Hi,
First - You did great job with VirtualTreeView. I'am trying to add BringIntoView (scrolling to specific item) functionality to VirtualTreeViewItem, but I cannot make it. Do you have any tips how to make it?

Selection lost when scrolling

Hi. I'm trying your VirtualTreeView to see if I get around to the extremely bad performance and unpredictable behavior of the stock TreeView virtualized.

So I executed your demo and noticed two things:

1.- When selecting any node under 1.4 (like 1.4.1) in the VirtualTreeView Direct content (top right) it always crashes with a ParentTreeView = null error.

2.- When you select a node in the Data Bound (bottom right) section and you scroll and then go back to where the node is, the selection is lost.

My main problem with TreeView is that it's extremely difficult to do stupid things like "show this node even if it hasn't been realized yet" when somebody searches for an specific node that hasn't been loaded yet. I wonder if your solution addresses this problem, but I'm afraid you didn't implement anything like a BringIntoView() function.

Virtualization comparison and use case

Hi - this looks like a great effort to build a more performant and usable TreeView.

One thing I noticed in the demo application, is that the bound standard-TreeView has Virtualization explicitly turned off. After enabling it, the loading and memory usage are drastically improved such that the difference between the TreeView types is not as apparent.

In you experience, in what usage scenarios does the standard control fail?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.