Retaining the selection to the new node using TreeviewAdv Demo

Hi, Using the TreeViewAdv with the context menu removed from the tree; when you right click on a node, the selection changes to the node that is being clicked. On releasing previously selected node(old node) is getting selected. But I don''t want this to happen. I want the selection changed to the new node, like the original TreeViewAdv demo with the context menu inplace. I am using TreeviewAdv Demo. Thanks in advance, Regards, Krishna.

2 Replies

DT Deepa TS Syncfusion Team December 15, 2005 08:52 AM UTC

Hi Krishna, Please refer to the sample attached along with this, that shows how you could accomplish the above by handling the TreeViewAdv''s MouseDown event as shown below : private void treeViewAdv1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.Button == MouseButtons.Right) { //Getting the mouse right clicked point Point p = this.treeViewAdv1.PointToClient(Control.MousePosition); // Getting the node at the right click point TreeNodeAdv node = this.treeViewAdv1.PointToNode(p); // set the newly selected node this.treeViewAdv1.SelectedNode = node; } } Let me know if this meets your requirements. Thanks for your interest in Syncfusion products. Regards, Deepa.T.S

RightClick.zip


AD Administrator Syncfusion Team December 22, 2005 10:00 AM UTC

Hi Deepa, Its working great now. Thanks a lot. Regards, Krishna.

Loader.
Up arrow icon