Ejemplo n.º 1
0
 protected virtual void OnSortChanging(SortChangingEventArgs e)
 {
     if (SortChanging != null)
     {
         SortChanging(this, e);
     }
 }
Ejemplo n.º 2
0
        public void ApplySort(System.ComponentModel.ListSortDescriptionCollection sorts)
        {
            var args = new SortChangingEventArgs()
            {
                Sort = sorts, Handled = false
            };

            OnSortChanging(args);
            if (args.Handled)
            {
                sorts = args.Sort;
            }

            _descrips = sorts;
            if (sorts == null || sorts.Count < 1)
            {
                if (_filter == null)
                {
                    _filterIds.Clear();
                }
                else
                {
                    _filterIds.Sort();
                }
            }
            else
            {
                if (!_filterIds.Any() && _filter == null)
                {
                    _filterIds.AddRange(Enumerable.Range(0, _list.Count));
                }
                _filterIds.Sort((x, y) => CompareProp((T)_list[x], (T)_list[y]));
            }

            ResetBindings();
        }