Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I want to get Highlighted Node from TreeView.

TreeView.SelectedNode doesn't return the one highlighted.

When you select node by left mouse button, SelectedNode is same as hightlighted Node. But, if you select it by Right mouse button, SelectedNode doesn't return the one hightlighted.

 

How can I get it?

Thank you all..

Sun Certified Web component Developer,

Microsoft Certified Solution Developer .NET,

Software Engineer

  • Leaders
Posted

On the mousedown event, I would store a reference to the node returned by TreeView.GetNodeAt(e.X, e.Y), since the node under the mouse cursor is the one that will be selected, then on the context menu handlers (or wherever else you need) use that node you got from TreeView.GetNodeAt(e.X, e.Y) instead of TreeView.SelectedNode().

 

Sometimes what I do to simplify things is just select the node that they right-click in the mousedown event, i.e. TreeView.SelectedNode = TreeView.GetNodeAt(e.X, e.Y)

[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...