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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Setting the checkboxes in the TreeViewAdv by selecting the labels

Thread ID:

Created:

Updated:

Platform:

Replies:

27466 Apr 13,2005 12:26 PM UTC Apr 13,2005 03:38 PM UTC WinForms 1
loading
Tags: Tools
Jeremy Dickson
Asked On April 13, 2005 12:26 PM UTC

Hi, Is it possible to set the Checked flag of tree nodes by the user clicking on the label rather than the checkboxes? I have implemented it by listening for the tree AfterSelect events and setting the Checked property of the selected node but requires quite a bit of coordinated event handling complicated by different behaviour if the tree has just got focus. If not, it might be a good idea for the next release. Jeremy Dickson.

Administrator [Syncfusion]
Replied On April 13, 2005 03:38 PM UTC

Hi Jeremy, TreeViewAdv contains methods that allow you to convert Control.MousePosition into a location inside the TreeViewAdv. If you handle MouseDown, you can use those methods to detect whether or not a label was clicked on and set the Checked property accordingly. The following code snippet demonstrates this: 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; } } } } Hope it helps. Regards, Gregory Austin Syncfusion Inc.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;