Link to home
Start Free TrialLog in
Avatar of andreas_rafn
andreas_rafnFlag for Denmark

asked on

How can I disable selection of a TreeNode in a TreeView in VB.NET?

I'm currently implementing a navigation menu using a TreeView control.

In the menu I'm using headers (root nodes) to group menu items. These headers should only have one purpose: double-click collapse/uncollapse. For this reason it should'nt be possible to select and mark the node, but as default this is possible. What can I do to avoid that the headers can be selected? And is there a way to do this by setting TreeNode properties so that selection events doesn't have to be handled?
Avatar of Luis Pérez
Luis Pérez
Flag of Spain image

Are you using Windows Forms or Web Forms?
Avatar of andreas_rafn

ASKER

Windows Forms (System.Windows.Forms.TreeView)
ASKER CERTIFIED SOLUTION
Avatar of IceBird26
IceBird26

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hehe...guess I'm 20 seconds too late!  =)
The fastest submitter gets a little more :) The approach seems good, I'll try to combine it with a handling of the selection color so that the temporary selection will be invisible.