From 8c0c975aea4e1ea9a6beed233adcff40214d5545 Mon Sep 17 00:00:00 2001 From: tznind Date: Wed, 25 Nov 2020 07:16:33 +0000 Subject: [PATCH] Changed example to show folders first then files (and ensure alphabetical order) --- UICatalog/Scenarios/TreeViewFileSystem.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/UICatalog/Scenarios/TreeViewFileSystem.cs b/UICatalog/Scenarios/TreeViewFileSystem.cs index bc02b3bb6..59805f22a 100644 --- a/UICatalog/Scenarios/TreeViewFileSystem.cs +++ b/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(model is DirectoryInfo d) { try { - return d.GetFileSystemInfos(); + return d.GetFileSystemInfos() + //show directories first + .OrderBy(a=>a is DirectoryInfo ? 0:1) + .ThenBy(b=>b.Name); } catch(SystemException ex) { return new []{ex};