src/GenFx.Components/Trees/TreeHelper.cs
/// <summary>
/// Replaces <paramref name="locationNode"/> by moving <paramref name="movingNode"/> with all of its children to the location of <paramref name="locationNode"/>.
/// </summary>
/// <param name="movingNode"><see cref="TreeNode"/> to be moved.</param>
/// <param name="locationNodeTree"><see cref="TreeEntityBase"/> containing the <paramref name="locationNode"/>.</param>
/// <param name="locationNode"><see cref="TreeNode"/> where <paramref name="movingNode"/> should be moved to.</param>
/// <param name="locationParentNode"><see cref="TreeNode"/> of the parent of <paramref name="locationNode"/>.</param>
Replaces  by moving  with all of its children to the location of .
Replaces by moving with all of its children to the location of .
public static void ReplaceNodeInTree(TreeNode movingNode, TreeEntityBase locationNodeTree, TreeNode locationNode, TreeNode? locationParentNode)
        {
            if (movingNode is null)
            {
                throw new ArgumentNullException(nameof(movingNode));
            }
            if (locationNodeTree is null)
            {
                throw new ArgumentNullException(nameof(locationNodeTree));
            }
            if (locationNode is null)
            {
                throw new ArgumentNullException(nameof(locationNode));
            }
            if (locationParentNode is null)
            {
                locationNodeTree.SetRootNode(movingNode);
            }
            else
            {
                int childIndex = locationParentNode.ChildNodes.IndexOf(locationNode);
                locationParentNode.ChildNodes.Remove(locationNode);
                locationParentNode.InsertChild(childIndex, movingNode);
            }
        }
public static void ReplaceNodeInTree ( TreeNode movingNode , TreeEntityBase locationNodeTree , TreeNode locationNode , TreeNode ? locationParentNode ) { if ( movingNode is null ) { throw new ArgumentNullException ( nameof ( movingNode ) ) ; } if ( locationNodeTree is null ) { throw new ArgumentNullException ( nameof ( locationNodeTree ) ) ; } if ( locationNode is null ) { throw new ArgumentNullException ( nameof ( locationNode ) ) ; } if ( locationParentNode is null ) { locationNodeTree . SetRootNode ( movingNode ) ; } else { int childIndex = locationParentNode . ChildNodes . IndexOf ( locationNode ) ; locationParentNode . ChildNodes . Remove ( locationNode ) ; locationParentNode . InsertChild ( childIndex , movingNode ) ; } }
Replaces  by moving  with all of its children to the location of .
Replaces by moving with all of its children to the location of .
movingNode
TreeNode
to be moved.
to be moved .
locationNodeTree
TreeEntityBase
containing the .
containing the .
locationNode
TreeNode
None
locationParentNode
TreeNode?
of the parent of .
of the parent of .