goodmorningsky Posted April 22, 2005 Posted April 22, 2005 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.. Quote Sun Certified Web component Developer, Microsoft Certified Solution Developer .NET, Software Engineer
Leaders snarfblam Posted April 23, 2005 Leaders Posted April 23, 2005 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) Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.