Hi,
I am using the drag drop function that is found in the examples shipped with the Infragistics control. Within FormLoad, I have this line of code here:
trvModules.Override.SelectionType = Infragistics.Win.UltraWinTree.SelectType.ExtendedAutoDrag;
And in my MouseUp event handler, I have:
if (e.Button == MouseButtons.Right)
{
Point p = new Point(e.X, e.Y);
UltraTreeNode node = trvModules.GetNodeFromPoint(p);
node.Selected = true;
}
The problem is: none of the nodes gets deselected. I can right click multiple nodes of the tree, and all of them remains selected.
However, when I comment out this line:
the node selection works as expected, that is the nodes gets selected(highlighted) exclusively. But uncommenting that line affects the drag-drop effect. How can I solve this issue?
You could also use the ISelectionManager meneger interface to select the node and clear the existing selection in one atomic operation:
private void ultraTree1_MouseDown(object sender, MouseEventArgs e){ UltraTree tree = sender as UltraTree;
if (e.Button == MouseButtons.Right) { UltraTreeNode node = tree.GetNodeFromPoint(e.Location);
if ( node != null ) { ISelectionManager selectionManager = tree as ISelectionManager; selectionManager.SelectItem( node, true ); } } }
hi, you can deselect all the nodes by code before selecting the new node:
ultraTree1.SelectedNodes.Clear()