private void treeList1_VirtualTreeGetChildNodes(object sender, DevExpress.XtraTreeList.VirtualTreeGetChildNodesInfo e) { Cursor current = Cursor.Current; Cursor.Current = Cursors.WaitCursor; if (!loadDrives) { string[] roots = Directory.GetLogicalDrives(); e.Children = roots; loadDrives = true; } else { try { var path = (string)e.Node; if (Directory.Exists(path)) { var dirs = Directory.GetDirectories(path); var files = Directory.GetFiles(path); var arr = new string[dirs.Length + files.Length]; dirs.CopyTo(arr, 0); files.CopyTo(arr, dirs.Length); e.Children = arr; } else { e.Children = new object[] { } }; } catch { e.Children = new object[] { }; } } Cursor.Current = current; }
private void treeList1_VirtualTreeGetChildNodes(object sender, DevExpress.XtraTreeList.VirtualTreeGetChildNodesInfo e) { String sCurrentNode = e.Node as String; if (sCurrentNode == null) { e.Children = new string[] { "Root node 1", "Root node 2", "Root node 3" }; } else { e.Children = CreateChildrenNodes(sCurrentNode); } }