예제 #1
0
        private async Task Sort(MemberPathSortingDirection memberPathSortingDirection)
        {
            while (this._filterWaitingCount != 0)
            {
                await Task.Delay(500);
            }
            var sortDirection  = memberPathSortingDirection.SortDirection;
            var sortMemberPath = memberPathSortingDirection.MemberPath;

            switch (sortDirection)
            {
            case null:
                this._myRemoteOrDbDataSourceAsyncProxy.SortDescriptionList.Remove(sortMemberPath);
                break;

            case ListSortDirection.Ascending:
                this._myRemoteOrDbDataSourceAsyncProxy.SortDescriptionList.Add(
                    new SortDescription(sortMemberPath, ListSortDirection.Ascending));
                break;

            case ListSortDirection.Descending:
                this._myRemoteOrDbDataSourceAsyncProxy.SortDescriptionList.Add(
                    new SortDescription(sortMemberPath, ListSortDirection.Descending));
                break;
            }

            this._myRemoteOrDbDataSourceAsyncProxy.FilterDescriptionList.OnCollectionReset();
            this._myDataVirtualizedAsyncFilterSortObservableCollection.Clear();
        }
예제 #2
0
        private void Sort(MemberPathSortingDirection pathSortingDirection)
        {
            var propertyName       = pathSortingDirection.MemberPath;
            var sortingDirection   = pathSortingDirection.SortDirection;
            var currentDescription =
                this.CollectionViewSource.SortDescriptions.FirstOrDefault(sd => sd.PropertyName.Equals(propertyName));

            if (currentDescription.PropertyName != null && currentDescription.PropertyName.Equals(propertyName))
            {
                this.CollectionViewSource.SortDescriptions.Remove(currentDescription);
            }

            if (!sortingDirection.HasValue)
            {
                return;
            }

            this.CollectionViewSource.SortDescriptions.Add(new SortDescription(propertyName,
                                                                               sortingDirection.Value));
        }