File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed
Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -360,15 +360,24 @@ private void ApplyFiltering(bool maintainPosition = false)
360360 query = query . Where ( item => _searchSelectors . Any ( selector => matches ( selector ( item ) ?? string . Empty ) ) ) ;
361361 }
362362
363- if ( maintainPosition && _filtered . Any ( ) )
364- {
365- _currentPage = Math . Clamp ( oldFirstItemIndex / _pageSize , 0 , TotalPages - 1 ) ;
366- }
367- else
363+ if ( _sorts . Count > 0 )
368364 {
369- _currentPage = 0 ;
365+ IOrderedEnumerable < T > ? orderedQuery = null ;
366+ foreach ( var ( selector , ascending ) in _sorts )
367+ {
368+ if ( orderedQuery == null )
369+ {
370+ orderedQuery = ascending ? query . OrderBy ( selector ) : query . OrderByDescending ( selector ) ;
371+ }
372+ else
373+ {
374+ orderedQuery = ascending ? orderedQuery . ThenBy ( selector ) : orderedQuery . ThenByDescending ( selector ) ;
375+ }
376+ }
377+ query = orderedQuery ?? query ;
370378 }
371- RaiseAllChanged ( ) ;
379+
380+ _filtered = query . ToList ( ) ;
372381 }
373382
374383 private static string WildcardToRegex ( string pattern )
You can’t perform that action at this time.
0 commit comments