I have treeview control on a winform and need to implement onChange event for it. However, it looks like it doesn’t have one and only has onChangeUI.
If the treeview doesn’t support onChange event, what is its equivalent in .NET.
I’ve searched MSDN Library and didn’t find any information.
Update: a side note I am converting win32 program for .net.
Thanks in advance,
Support for selection change is a little limited in the Windows Forms TreeView control.
Basically, there is a pair of events (BeforeSelect and AfterSelect) that allow you to react when a tree node is selected.
BeforeSelectallows you to cancel the new selection,AfterSelectdoes not (because it occurs after the new selection has been committed).However, none of these events are triggered when a node is unselected. To detect that case, you’ll have to handle the generic MouseUp event and check the IsSelected property of the clicked node to get the actual selection state.