Click here to Skip to main content
Click here to Skip to main content

Multi-select Treeview control v2.0

, 15 Aug 2004
Rate this:
Please Sign up or sign in to vote.
Multi-select Treeview control v2.0



This is a multi select TreeView Control for the .NET framework. It is possible to select TreeNodes in multiple ways with or without constraints.


The MWTreeView has a few ways of mouse-selecting the TreeNodes by painting anything from a rubberband to very graphical representations. There is even the possibility, using GDI+, to customize the mouse-selection. It is also possible to have TreeNodes of various colors within the same MWTreeView with multi-selection still working. The MWTreeView has a massive amount of configurable settings so that anyone should be able to tailor it to their needs.

Note that when selecting TreeNodes in code the SelectNode (DeselectNode also exists) method should be used. Note that when changing the colors of a TreeNode the ChangeColors method should be used. Do not just change the colors of a TreeNode.

Note that in order to iterate through the selected TreeNodes the following method has to be used (selected TreeNodes are stored in a Hashtable):

foreach(MWTreeNodeWrapper mwtnw in mwtvMWTreeView.SelNodes.Values)
   MessageBox.Show("The " + mwtnw.Node.Text + 
    " TreeNode is selected.");

Contacting me

I can be reached through the forum here at CodeProject or through one of my addresses:

  • My mik address can be found on
  • My mick address can be found on
  • My mikwib address can be found on


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Mikael Wiberg
Web Developer
Sweden Sweden
No Biography provided

Comments and Discussions

QuestionHow to access checked items? PinmemberAlexander Pikus3-Nov-08 20:09 
GeneralDraga and Drop Behavior PinmemberLarry Dodd5-Mar-08 11:45 
GeneralRe: Draga and Drop Behavior Pinmembervinutha kempanna5-Mar-08 11:57 
GeneralRe: Draga and Drop Behavior PinmemberMikael Wiberg5-Mar-08 20:03 
QuestionGreat code, license question? Pinmemberthatrickguy29-Nov-07 6:53 
AnswerRe: Great code, license question? PinmemberMikael Wiberg29-Nov-07 7:42 
GeneralOdd behaviour on deselect [modified] Pinmemberbenjymous19-Sep-07 23:09 
Hi - thanks for the great control - it seems to be doing exactly what I need for my project, although I'm getting a bit of weird behaviour.
Each of my treenodes can potentially have a different imagekey set. When the tree is drawn it all displays correctly, but any nodes that are deselected seem to revert to the tree's default imagekey instead of using the node's imagekey.
[edit] it also happens with multiselect, if I click one node, then shift-select another, the first node gets the default image key[/edit]
[edit2] on closer inspection, it appears that the imagekey property of my nodes is getting cleared at some point after selection [/edit2]
Is there a property I need to set to fix this (which works fine in the regular MS tree) or do I need to add some extra code when adding my nodes to instruct the tree what to do?


-- modified at 4:29 Thursday 20th September, 2007
Help me! I'm turning into a grapefruit!

GeneralNodes.Clear Doesn't Clear SelNodes PinmemberChristopher Theunissen20-Apr-07 2:16 
GeneralRe: Nodes.Clear Doesn't Clear SelNodes PinmemberMikael Wiberg20-Apr-07 7:07 
QuestionSearch as you type doesn't work on the SameLevelMultiBranch Pinmembersofter2-Apr-07 1:58 
AnswerRe: Search as you type doesn't work on the SameLevelMultiBranch [modified] PinmemberMikael Wiberg9-Apr-07 1:27 
QuestionCheckboxes Pinmembersofter22-Dec-06 13:59 
AnswerRe: Checkboxes Pinmembersofter22-Dec-06 15:17 
GeneralRe: Checkboxes Pinmembersofter22-Dec-06 15:53 
GeneralRe: Checkboxes PinmemberMikael Wiberg22-Dec-06 18:46 
GeneralComercial Version PinmemberFooDogCom16-Dec-06 14:44 
GeneralRe: Comercial Version PinmemberMikael Wiberg16-Dec-06 21:06 
GeneralProblem with the highlighting/unhighlighting Pinmemberjebrew20-Sep-06 7:08 
GeneralLatest Version with DataBinding PinmemberJacob Shepherd29-Nov-05 13:46 
GeneralDeep Logic bug about selecting node(s) PinmemberLe_MuLoT13-Sep-05 5:17 
AnswerRe: Deep Logic bug about selecting node(s) PinmemberMikael Wiberg14-Sep-05 3:04 
GeneralRe: Deep Logic bug about selecting node(s) PinmemberLe_MuLoT14-Sep-05 4:13 
GeneralRe: Deep Logic bug about selecting node(s) PinmemberMikael Wiberg14-Sep-05 4:51 
GeneralRe: Deep Logic bug about selecting node(s) PinmemberLe_MuLoT14-Sep-05 8:12 
GeneralRe: Deep Logic bug about selecting node(s) PinmemberMikael Wiberg14-Sep-05 11:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150123.1 | Last Updated 16 Aug 2004
Article Copyright 2004 by Mikael Wiberg
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid