How come the UltraTree control fires a DoubleClick event, when I doubleclick on the scrollbar?
The result is that DoubleClick fires, when a user is scolling up or down, and is clicking a little bit too fast on the up or down arrows.
Is there a way to disable or work around this feature?
Regards,
Jørn
I don't want to filter out hits on the expansion indicators, I just don't want double-clicking the expansion indicators to qualify the same as double-clicking the node text or node image.
For example: Right now, if a node is selected, and the user clicks any expansion indicator twice, quickly, the double-click event fires and my code runs as if they clicked a node. This is very confusing for a user.
Can we please get a NodeDoubleClick event? Seems logical to me that double-clicking a node is going to be the most common UI action for a treeview control...
Yes, they are. You could do something like this if you want to "filter out" hits on the expansion indicator:
void treeControl_MouseDown(object sender, MouseEventArgs e){ UltraTree treeControl = sender as UltraTree; UIElement controlElement = treeControl.UIElement; UIElement elementAtPoint = controlElement != null ? controlElement.ElementFromPoint( e.Location ) : null; NodeSelectableAreaUIElement nodeElement = null;
while ( elementAtPoint != null ) { nodeElement = elementAtPoint as NodeSelectableAreaUIElement; if ( nodeElement != null ) break;
elementAtPoint = elementAtPoint.Parent; }
if ( nodeElement != null ) { UltraTreeNode node = nodeElement.Node; }}
this code works for the most part. doesn't take into consideration the expansion indicators. if a node is selected, then you double click an expansion indicator, node will not be null, and my double-click event code will run...
I tried this as an alternative, and did the same thing:
UltraTreeNode aNode = this.HierarchyDataSetTree.GetNodeFromPoint(new Point(margs.X, margs.Y));
{
\\ do stuff
are expansion indicator UI elements considered part of a node?
Yes, that did the trick!
I wasn't aware of the LastElementEntered property.
Thank you very much.Jørn.
Hi Joesn,
In that case, you are probably using the ActiveNode to get the node that was double-clicked. But that's not really a good idea, since the user could double-click on empty space in the tree or on an expansion indicator and you probably don't want to trigger at this point.
What I would do in DoubleClick is something like this:
UltraTreeNode node = this.ultraTree1.UIElement.LastElementEntered.GetContext(typeof(UltraTreeNode)) as UltraTreeNode;
if (node != null)
// Do something
This way you only respond if the last element the mouse entered is inside a node.