@@ -73,6 +73,21 @@ public DetailsLayoutPage() : base()
7373 DataContext = this ;
7474 var selectionRectangle = RectangleSelection . Create ( FileList , SelectionRectangle , FileList_SelectionChanged ) ;
7575 selectionRectangle . SelectionEnded += SelectionRectangle_SelectionEnded ;
76+
77+ UpdateSortOptionsCommand = new RelayCommand < string > ( x =>
78+ {
79+ if ( ! Enum . TryParse < SortOption > ( x , out var val ) )
80+ return ;
81+ if ( FolderSettings . DirectorySortOption == val )
82+ {
83+ FolderSettings . DirectorySortDirection = ( SortDirection ) ( ( ( int ) FolderSettings . DirectorySortDirection + 1 ) % 2 ) ;
84+ }
85+ else
86+ {
87+ FolderSettings . DirectorySortOption = val ;
88+ FolderSettings . DirectorySortDirection = SortDirection . Ascending ;
89+ }
90+ } ) ;
7691 }
7792
7893 // Methods
@@ -150,21 +165,6 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
150165 if ( parameters . IsLayoutSwitch )
151166 _ = ReloadItemIconsAsync ( ) ;
152167
153- UpdateSortOptionsCommand = new RelayCommand < string > ( x =>
154- {
155- if ( ! Enum . TryParse < SortOption > ( x , out var val ) )
156- return ;
157- if ( FolderSettings . DirectorySortOption == val )
158- {
159- FolderSettings . DirectorySortDirection = ( SortDirection ) ( ( ( int ) FolderSettings . DirectorySortDirection + 1 ) % 2 ) ;
160- }
161- else
162- {
163- FolderSettings . DirectorySortOption = val ;
164- FolderSettings . DirectorySortDirection = SortDirection . Ascending ;
165- }
166- } ) ;
167-
168168 FilesystemViewModel_PageTypeUpdated ( null , new PageTypeUpdatedEventArgs ( )
169169 {
170170 IsTypeCloudDrive = InstanceViewModel ? . IsPageTypeCloudDrive ?? false ,
0 commit comments