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,