/// <summary> /// /// </summary> /// <param name="curDir"></param> public void ExpandToCurrentNode(DirInfo curDir) { //expand the current selected node in tree //if this is an ancestor of the directory we want to navigate or "My Computer" current node if (CurrentTreeItem != null && (curDir.Path.Contains(CurrentTreeItem.Path) || CurrentTreeItem.Path == Resources.My_Computer_String)) { // expand the current node // If the current node is already expanded then first collapse it n then expand it CurrentTreeItem.IsExpanded = false; CurrentTreeItem.IsExpanded = true; } }
/// <summary> /// ctor /// </summary> /// <param name="evm"></param> public FileExplorerViewModel(ExplorerWindowViewModel evm) { _evm = evm; //create a node for "my computer" // this will be the root for the file system tree DirInfo rootNode = new DirInfo(Resources.My_Computer_String); rootNode.Path = Resources.My_Computer_String; _evm.CurrentDirectory = rootNode; //make root node as the current directory SystemDirectorySource = new List <DirInfo> { rootNode }; }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { try { DirInfo nodeToExpand = value as DirInfo; if (nodeToExpand == null) { return(null); } //return the subdirectories of the Current Node if ((ObjectType)nodeToExpand.DirType == ObjectType.MyComputer) { return((from sd in FileSystemExplorerService.GetRootDirectories() select new DirInfo(sd)).ToList()); } else { return((from dirs in FileSystemExplorerService.GetChildDirectories(nodeToExpand.Path) select new DirInfo(dirs)).ToList()); } } catch { return(null); } }