From e69279554f4707e87c82c43b04170b085b645821 Mon Sep 17 00:00:00 2001 From: hishitetsu <66369541+hishitetsu@users.noreply.github.com> Date: Sat, 6 Apr 2024 19:10:51 +0900 Subject: [PATCH] Fix sorting --- .../Views/Layouts/DetailsLayoutPage.xaml.cs | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs b/src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs index d5db6ad8515f..f214439176d8 100644 --- a/src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs +++ b/src/Files.App/Views/Layouts/DetailsLayoutPage.xaml.cs @@ -73,6 +73,21 @@ public DetailsLayoutPage() : base() DataContext = this; var selectionRectangle = RectangleSelection.Create(FileList, SelectionRectangle, FileList_SelectionChanged); selectionRectangle.SelectionEnded += SelectionRectangle_SelectionEnded; + + UpdateSortOptionsCommand = new RelayCommand(x => + { + if (!Enum.TryParse(x, out var val)) + return; + if (FolderSettings.DirectorySortOption == val) + { + FolderSettings.DirectorySortDirection = (SortDirection)(((int)FolderSettings.DirectorySortDirection + 1) % 2); + } + else + { + FolderSettings.DirectorySortOption = val; + FolderSettings.DirectorySortDirection = SortDirection.Ascending; + } + }); } // Methods @@ -150,21 +165,6 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs) if (parameters.IsLayoutSwitch) _ = ReloadItemIconsAsync(); - UpdateSortOptionsCommand = new RelayCommand(x => - { - if (!Enum.TryParse(x, out var val)) - return; - if (FolderSettings.DirectorySortOption == val) - { - FolderSettings.DirectorySortDirection = (SortDirection)(((int)FolderSettings.DirectorySortDirection + 1) % 2); - } - else - { - FolderSettings.DirectorySortOption = val; - FolderSettings.DirectorySortDirection = SortDirection.Ascending; - } - }); - FilesystemViewModel_PageTypeUpdated(null, new PageTypeUpdatedEventArgs() { IsTypeCloudDrive = InstanceViewModel?.IsPageTypeCloudDrive ?? false,