Advanced TreeView

Advanced TreeView for .NET Windows Forms

The Bad - Windows Forms TreeView Control

I'm sad to say that Borland have done a much better job at subclassing the TreeView control for its VCL in the 1990's than what Microsoft have done a decade later for its WinForms. Among others, the ones that stood out when I first used the TreeView control in Windows Forms was that the TreeView control in Borland allows multiselection of TreeNodes and that its tooltip appeared on top of the node with its text perfectly aligned to the pixel. The WinForms TreeView's tooltip looks especially awful when the ItemHeight is set to a much larger value. Have a look at this sample:

Tooltip and its text misaligned with node and text
This unfortunately is one of the more subtle bugs of the Microsoft TreeView control. Simply Google for "TreeView bugs" and "TreeView performance" and you'll be surprised how many people are complaining. Let's also not forget that the Borland one fully supported DoubleBuffered property whereas the Microsoft one does not.

However, as neither gave me the ability to draw rich text on both its nodes and tooltip, my first reaction was to look for a third party control that does this, as well as multi-select and a properly aligned tooltip. After spending quite a bit of time looking around, I found no TreeView controls that meet the following requirements:
  • Must derive from System.Windows.Forms.TreeView (I want all my existing code to be 100% compatible)
  • Uses System.Windows.Forms.TreeNode (again, compatibility)
  • Behaves like a normal WinForms TreeView but with bugs fixed
  • Multiselection support
  • A Multiselect TreeView which is as native as possible
  • Not custom themed (thus using native OS theming - behaves like other XP controls in XP, and Vista controls in Vista and so on for future OSes)
  • Able to draw rich text on both tooltip and node text
Let's not go any further with the list - at this point, none of the TreeView controls out there would meet the above requirements. Heck, if Microsoft gets their hands on a TreeView control which meets the above requirements, I have no doubts that they would simply include it in their next release of Visual Studio!

The objective, hence, was to create the ultimate TreeView - i.e. A TreeView that is worth Microsoft including with Visual Studio, replacing their own TreeView control.

The Solution - Advanced TreeView

Meet Advanced TreeView (running in Vista and XP):


Advanced TreeView

Oh, and the feature list goes on:
  • Select / unselect / focus TreeNode via WinAPI - not setting back color
  • Built-in drag-drop effects with automatic node expand (enabled and delay customizable)
  • Full keyboard multiselection support - F2 in-place edit, Ctrl+key, Shift+key, and Ctrl+Shift+key
  • DoubleBuffered support - works perfectly with or without double buffering
  • Tooltip aligned with node and node text
  • Vista TreeView 'explorer' mode support
  • Same multiselection behavior in both XP and Vista
  • Custom / owner drawn tooltip with custom positioning and sizing on tooltip Popup
  • Hardware accelerated double buffering and drawing techniques
  • Fastest (most responsive) double buffered TreeView - most third-party TreeViews are sluggish when redrawing
  • Small assemblies diskspace and memory footprint
  • Should have been THE TreeView control for Visual Studio - shame on Microsoft for their half-hearted attempt at wrapping the SysTreeView32 Common Control

Be warned though, this control won't meet .NET purists' (purists - yuck!) requirements - and it's not meant to. Three of the four base classes of this control should have been part of the .NET framework.

Buy Advanced TreeView


Download Advanced TreeView

Latest Version: 1.0.1 (Updated on 23 July 2008)

Requirements:
  • Visual Studio 2005 / 2008
  • .NET v2.0
  • Language compatibility: MC++, VB, C#, J#


Download the demo application here:

download    advancedtreeview_v1_demo.zip    66.95kB




Demo of Advanced TreeView for .NET Framework Windows Forms
Simply unzip to a folder and run the demo.

If you do not have Visual Studio 2005 with SP1 and Vista update installed, you will also need Microsoft.VC80.CRT:
microsoft_vc80_crt.zip
(unzip these files to the same folder as the demo application)

For support, visit the Advanced TreeView Forum.


Known problem with Vista's TreeView:

When indent is set to a value other than the default, plusminus / button does not respond to mouse click correctly. Microsoft have been informed of the problem. Read more about it here.


Restrictions:

Demo control has the following restrictions (by downloading, you agree to the following terms and conditions):
  • Not to be redistributed
  • Assemblies (DLLs) are not to be used in Designer, or as part of another application besides the one included with the above distribution
  • The word "eval" will randomly appear on the screen
  • If you wish to evaluate the control in Visual Studio's Designer, please request for an evaluation version
  • Other standard software EULAs such as this.

Change History

Version 1.0.1
  • Fixed bug: Drag and drop with marker - if AllowDrop is disabled, dropping will cause marker to be drawn (should not be drawn).
  • Fixed bug: Drag and drop from another window / application - marker not drawn.
Version 1.0.0
  • Pilot Release