We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How do I know multiselect inside AfterSelect event?

Hi, I am using treeviewadv. In AfterCheck event, I would like to know whehter there are more than one node selected when this node is selected? For example, I use Ctrl click to select multiple nodes, I would like to do something only when the first node is selected. Is there any way to do it? Thanks Chris

1 Reply

DT Deepa TS Syncfusion Team April 4, 2006 08:37 AM UTC

Hi Chris, In AfterCheck event, you could know whether there are more than one node selected, when a particular node is selected using the following code snippet. private void treeViewAdv1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.Button == MouseButtons.Left) // get the point where the mouse was left clicked Point p = this.treeViewAdv1.PointToClient(Control.MousePosition); // get the node at the left click point TreeNodeAdv node = this.treeViewAdv1.PointToNode(p); if (node != null) { // see if the label was clicked on if (node.TextAndImageBounds.Contains(p)) { node.Checked =!node.Checked; } } } int i=0; private void treeViewAdv1_AfterCheck(object sender, Syncfusion.Windows.Forms.Tools.TreeNodeAdvEventArgs e) { i++; TreeNodeAdv node=new TreeNodeAdv(); Console.WriteLine("AfterCheck fired"+i.ToString()); } //If the selected node is first node it allows to make changes else no changes private void treeViewAdv1_AfterSelect(object sender, System.EventArgs e) { if(this.treeViewAdv1.SelectedNode==this.treeViewAdv1.Nodes[0]) { MessageBox.Show("Make changes"); } else { MessageBox.Show("No changes"); } } Please take a look at the sample and let me know if this helps you. Thanks for your interest in Syncfsuion products. Regards, Deepa.

LabelCheck.zip

Loader.
Live Chat Icon For mobile
Up arrow icon