The issue is the Select method in particular the line
DirectoryInfo rootDirectory = new DirectoryInfo(rootPath);
Thus each time the select method is run it returns the root directory
This can be fixed by using the _viewPath however by default this is return the folder's ToString() and not the FullName so its not a step by step path but just the last step in the path.
We fix this by editing the FileSystemHierarchyData's Path method
public string Path
{
get
{
return fileSystemObject.FullName;
}
}
Now we can alter the FileSystemDataSourceView's Select method to use either the rootPath or the _viewPath depending on if we are already part of the way down the tree
DirectoryInfo rootDirectory = new DirectoryInfo(_viewPath == string.Empty ? rootPath : _viewPath);
Then the recursion works.
Try setting the TreeView's ExpandDepth to 0 and stepping through the code to see what is happening as each branch is expanded.
Sebastian Rogers