C# Why is a treeview node clicked when canceled is set to true?

Posted by Martijn on Stack Overflow See other posts from Stack Overflow or by Martijn
Published on 2010-05-18T08:07:27Z Indexed on 2010/05/18 8:10 UTC
Read the original article Hit count: 179

Filed under:
|

In my winform application I have a treeview. To give the idea that a node is disabled I set the node's forecolor and I when the BeforeSelect fires I set e.cancel to true.

However when a node's tag meets some criteria a node may be selected. So that's why I have a NodeMouseClick. But when a node may not be clicked I set the e.cancel to true in the BeforeSelect event.

The problem now is, the NodeMousClick event is always fired and all the code is ececuted, even when I set e.cancel to true in the BeforeSelect event. Why is that?

© Stack Overflow or respective owner

Related posts about c#

Related posts about treeview