Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
950
Node Reposition makes nodes disappear
posted

Weird problem - hoping somebody can help me with it. Trying to do a simple drag and drop inside a UltraTree. Here is my sample tree - taken from a sample

groupTree.Nodes.Add("Continent:North America", "North America");
groupTree.Nodes.Add("Continent:South America", "South America");
groupTree.Nodes.Add("Continent:Antarctica", "Antarctica");
groupTree.Nodes.Add("Continent:Europe", "Europe");
groupTree.Nodes.Add("Continent:Asia", "Asia");

When I drag North America into South America both nodes disappear!!! But when I drag South America into North America code works just fine - in other words it seems to work when dragging down but not up.

Below is my Drop routine.

        private void groupTree_DragDrop(object sender, DragEventArgs e)
        {
            Point pt = ((UltraTree)sender).PointToClient(new Point(e.X, e.Y));
            UltraTreeNode DestinationNode = ((UltraTree)sender).GetNodeFromPoint(pt);

            if (e.Data.GetDataPresent("Infragistics.Win.UltraWinTree.SelectedNodesCollection", false))
            {
                SelectedNodesCollection selectedNodes = (SelectedNodesCollection)e.Data.GetData(typeof(SelectedNodesCollection));
                selectedNodes = selectedNodes.Clone() as SelectedNodesCollection;
                //Sort the selected nodes into their visible position.
                //This is done so that they stay in the same order when
                //they are repositioned.
                selectedNodes.SortByPosition();
                for (int i = 0; i <= (selectedNodes.Count - 1); i++)
                {
                    UltraTreeNode aNode = selectedNodes[i];
                    aNode.Reposition(DestinationNode.Nodes);
                }
            }
            groupTree.Invalidate();
        }

Parents
No Data
Reply
  • 69832
    Offline posted

    I was not able to reproduce the probelm you described here after replacing the contents of the 'UltraTree1_DragDrop' method (in the UltraTree Drag and Drop sample) with the code you posted here. If pssible please post the entire modified project so we can take a closer look. Note that it is possible that whatever problem you are having is being caused by a bug that has been fixed in a later version than the one you are using.

Children