How to: Implement "Click" event in a TreeView Control using .Net C

How to: Implement "Click" event in a TreeView Control using .Net C

Post by Y2hhcmxpZX » Sun, 13 Mar 2005 21:17:07


I would like to implement the following functionality:

When a user taps a (child) treeNode, an event fires which allows me to get
the selected treeNode's TAG object, determine it's values, and then load a
new form based on those values...

Intellisense shows the "Click" event, however, this does nothing. (I assume
it's not supported in .Net CF?) I see via Design Mode in VS 2003 that the
only feasible event is "AfterSelected". This, however, seems to loop through
all of the the treeNodes. I have to implement some sort of "hack" to avoid
this....

Any ideas on how to make the above happen?

Thanks,
 
 
 

How to: Implement "Click" event in a TreeView Control using .Net C

Post by Y2hhcmxpZX » Sun, 13 Mar 2005 22:37:07

To further my original question, i've run into another problem: Using the
AfterSelect event, this event runs through all of the nodes. I had thought
that i can cancel this event via the TreeViewCancelEventArgs class, however,
i cannot manage to make this work. Reading "Consuming Events" via MSDN
Library seems quite involved, and slightly beyond my understanding. Can
someone provide an example on how to make this event "cancel".

Currently, when the AfterSelect event loops though nodes which have not been
selected, i "avoid" exit the event by testing:

if (e.Action ==TreeViewAction.Unknown) return;

This, nevertheless, does not avoid the fact that the event contnues to loop
through all nodes....

Thanks,