I have a TreeView control showing multiple TreeNodes in an organised heirarchy. I want to stop the user selecting the highest level Nodes (this was achieved by using the BeforeSelect Event). I also want to stop the TreeView from highlighting the top level nodes if the user selects them i.e. stop the TreeView from changing the background color of the node and 'selecting' it.
The TreeView that I am using is the WinForms version of the control.
Below is the source code I am currently attempting to use:
private void tree_BeforeSelect ( object sender, TreeViewCancelEventArgs e )
{
if ( e.Node.Level == 0 )
{
e.Cancel = true;
}
}
This does de-select the Node but only after a noticible flash (~200ms) which is undesirable.