How can I make an ultra tree node expand on a single mouse click? I know there's a double mouse click action to toggle the expansion, but I can't see the same for a single mouse click. I've tried using the mouse click event and getting the node under the mouse; this worked apart from the event was also fired when you click on the expansion indicator. I want to keep the expansion indicator so I guess I either need a way to disable the built in expansionIndicator.click, or figure out whether the user clicked on the actual node or the expansion indicator.
private void ultraTree1_MouseDown(object sender, MouseEventArgs e){ UltraTree treeControl = sender as UltraTree; UltraTreeUIElement controlElement = treeControl.UIElement; UIElement elementAtPoint = controlElement != null ? controlElement.ElementFromPoint( e.Location ) : null;
bool isOverExpansionIndicator = false; UltraTreeNode nodeAtPoint = elementAtPoint != null ? elementAtPoint.GetContext( typeof(UltraTreeNode) ) as UltraTreeNode : null;
if ( nodeAtPoint != null ) { while ( elementAtPoint != null ) { if ( elementAtPoint is Infragistics.Win.UltraWinTree.ExpansionIndicatorUIElement ) { isOverExpansionIndicator = true; break; }
elementAtPoint = elementAtPoint.Parent; }
if ( isOverExpansionIndicator == false ) nodeAtPoint.Expanded = ! nodeAtPoint.Expanded; }}
Thanks! I'll give it a go. I was hoping there would be a built-in (or at least less complicated!) way of doing it :)
I'm also wondering the same thing, and since it's been almost two years, I thought I'd ask: is there a built-in feature now that allows you to expand nodes on a single click? I'm using the 2010.2 bundle. Thanks.