.net – Dynamic Context Menu on Treeview Nodes

contextmenunetright-clicktreeviewwinforms

Duplicate Of : Find node clicked under context menu

I've got a context menu on a Treeview, when the user right clicks it supposed to change based on the currently right clicked node's tag object.

Currently I'm updating the context menu in after_select event, however this doesn't work when user right clicks to another node without selecting it.

How can I detect which node right clicked and change the context menu? Or am I doing it wrong?

Best Answer

You can use the MouseDown event and the HitTest method to find out which node was clicked.

Related Topic