locked
Treeview issue for Right Click in Winforms RRS feed

  • Question

  • Hi All,

    I have been trying to implement right click functionality in the winforms treeview. What i noticed is the right click doesnt select the node where the click is made. Instead the right clicked node is temporarily selected (for less than a second) and the selection moves to the previously selected node. Observed that this happen even in the same hierarchy level. This makes implementing contextmenu functionality difficult for my scenario.

    It seems like its a bug with Windows Treeview. Is it correct? If so, are there any workarounds to resolve this. I tried programatically setting the selected node of the treeview based on the right click location. But it may create side effects like clicking while tree is collapsed, clicking outside the bounds etc.,

    Please help me on this. Thanks in Advance.

    Tuesday, April 24, 2012 1:45 PM

Answers

  • Hi,

    apparantly, i must have had the same problem, and looking at the behaviour of my treeview, i solved it by canceling the popup if the rightclick did not happen on the current node. It forces the user to select the node first, and then right click on it.


    Regards, Nico

    • Proposed as answer by Mike Feng Thursday, April 26, 2012 6:57 AM
    • Marked as answer by Mike Feng Tuesday, May 8, 2012 8:00 AM
    Tuesday, April 24, 2012 1:50 PM

All replies

  • Hi,

    apparantly, i must have had the same problem, and looking at the behaviour of my treeview, i solved it by canceling the popup if the rightclick did not happen on the current node. It forces the user to select the node first, and then right click on it.


    Regards, Nico

    • Proposed as answer by Mike Feng Thursday, April 26, 2012 6:57 AM
    • Marked as answer by Mike Feng Tuesday, May 8, 2012 8:00 AM
    Tuesday, April 24, 2012 1:50 PM
  • This is a question which has noting to do with the topic of this forum, however there is an extra very special forum for your problem.

    http://social.msdn.microsoft.com/Forums/en-US/winforms/threads


    Success
    Cor

    Wednesday, April 25, 2012 7:02 AM