• 0

[C#] Clicking Treeview Node Events..


Question

Ok, this is my problem:

I have a treeview, which has a list of categories, and when you select one, it loads items into a listview control. At the moment I'm using an After_Select event, but I want to use it to "refresh" the listview as well, so of course, the After_Select event won't fire. :\

Is there an event which:

Only occurs when a node is clicked, not the entire control (clicking down in an empty area and it still counting as a click is just ugly).

The event isn't select based.

Link to comment
https://www.neowin.net/forum/topic/479272-c-clicking-treeview-node-events/
Share on other sites

4 answers to this question

Recommended Posts

  • 0
  Winston said:

There's a NodeMouseClick event.

There is, and it works fine with being able to be clicked multiple times (since it doesn't care about the selection), but it gets abit screwy when clicking other items in the Treeview, the first click seems to be registered on the same node as before, and then the second click finally picks up that you've changed to a different node.

Probably should look up the order of events for this kind of thing...

  tmahmood said:

Select method might do the work for you.

first set a node to be selected

treeview.SelectedNode = treeview.Nodes[0];

then call Select

treeview.Select();

Where abouts would I call that code from? As if I put it inside the click events its going to go abit screwy I think (particularly with a select event :p)

  • 0

This Code works if you want to Refresh from Outside. Say Clicking a button.

  Quote

Is there an event which:

Only occurs when a node is clicked, not the entire control (clicking down in an empty area and it still counting as a click is just ugly).

as I remember there is no events like that. What you have to do is to check if any node is selected in the treeview control and do things accordingly.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.