Browse Source

Changed example to show folders first then files (and ensure alphabetical order)

tznind 4 years ago
parent
commit
8c0c975aea
1 changed files with 4 additions and 1 deletions
  1. 4 1
      UICatalog/Scenarios/TreeViewFileSystem.cs

+ 4 - 1
UICatalog/Scenarios/TreeViewFileSystem.cs

@@ -88,7 +88,10 @@ namespace UICatalog.Scenarios {
 			// If it is a directory it's children are all contained files and dirs
 			// If it is a directory it's children are all contained files and dirs
 			if(model is DirectoryInfo d) {
 			if(model is DirectoryInfo d) {
 				try {
 				try {
-					return d.GetFileSystemInfos();
+					return d.GetFileSystemInfos()
+						//show directories first
+						.OrderBy(a=>a is DirectoryInfo ? 0:1)
+						.ThenBy(b=>b.Name);
 				}
 				}
 				catch(SystemException ex) {
 				catch(SystemException ex) {
 					return new []{ex};
 					return new []{ex};