Hi,
I have an UltraTree that uses the MouseClick event to determine if a node is clicked. At this point if a node was clicked, I expand/collapse the node. I now want to allow for checkboxes, as well as this feature. The MouseClick fires before the BeforeCheck and AfterCheck events. Because of this, I do not know how to determine if the checkbox was clicked, and therefore the node is expanded/collapsed when the checkbox is checked. Is there anyway during the MouseClick event, that I can determine if the checkbox was clicked or the text of the node was clicked? I don't want the node expanded/collapsed when the node checkbox is clicked, only the text.
Thank you,
Jake
Mike,
I was using ctlTree.GetNodeFromPoint( e.X, e.Y ) to obtain the tree node associated with the mouse click position.
I'll give what you posted a try.
Thanks!!
Hi Jake,
How are you getting the node to expand/collapse? I assume you must be using UIElements. This is the same way you would determine if the click was on a checkbox.
private void ultraTree1_MouseClick(object sender, MouseEventArgs e) { UIElement element = this.ultraTree1.UIElement.LastElementEntered; if (element == null) return; // If the element is a checkbox, return. if (element is CheckIndicatorUIElement) return; // If the element is the child of a checkbox, return. if (element.GetAncestor(typeof(CheckIndicatorUIElement)) != null) return; // Get the node from the element (could be null). UltraTreeNode node = element.GetContext(typeof(UltraTreeNode)) as UltraTreeNode; }