fix moving items in sln explorer

This commit is contained in:
Matt Parker
2025-10-31 19:39:54 +10:00
parent 7fa1fedd1e
commit 86035b4628
2 changed files with 12 additions and 10 deletions

View File

@@ -52,6 +52,17 @@ public static class NodeExtensions
}
return null;
}
public void MoveToIndexInParent(int currentIndex, int newIndex)
{
var parent = treeItem.GetParent()!;
if (newIndex == currentIndex) throw new ArgumentException("New index is the same as current index", nameof(newIndex));
var target = parent.GetChild(newIndex);
if (newIndex < currentIndex)
treeItem.MoveBefore(target);
else
treeItem.MoveAfter(target);
}
}
extension(Node node)
{