TreeNode Selection Problems in C#

Posted by user455046 on Stack Overflow See other posts from Stack Overflow or by user455046
Published on 2011-01-15T22:29:39Z Indexed on 2011/01/15 22:54 UTC
Read the original article Hit count: 114

Filed under:
|

Whenever I click outside the tree nodes text, on the control part, it tigers a node click event- but doesn't highlight the node. I am unsure why this is happening.

I want the node to be selected on a click- when you click the nodes text- not the whitespace- I only assume that the nodes width reaches across the whole Treenode? I have the Treeview on dock.fill mode if that has something to do with it- I tried everything but can't get it to behave correctly.

Maybe someone will know what's going on.

Update: if (e.Location.IsEmpty) {

Seems to work better- but still selects the node in the blank place where there is no text- Obviously the node width extends across the whole treeview it seems?

Is there a better way to accomplish what I want? Or is that the best way?

UPDATE: Previous idea isn't working- sigh- I thought it did it but it didn't.

New Problem : I think part of the problem is related to the focus now when I switch from treeview.

© Stack Overflow or respective owner

Related posts about c#

Related posts about treeview