Пример #1
0
        /// <summary>
        /// Sorts a ListSortDescriptionCollection</summary>
        /// <param name="sortCollection">ListSortDescriptionCollection</param>
        public void ApplySort(ListSortDescriptionCollection sortCollection)
        {
            bool oldRaise = RaiseListChangedEvents;

            RaiseListChangedEvents = false;
            try
            {
                PropertyComparerCollection <T> tmp = new PropertyComparerCollection <T>(sortCollection);
                List <T> items = new List <T>(this);
                items.Sort(tmp);
                int index = 0;
                foreach (T item in items)
                {
                    SetItem(index++, item);
                }
                _sorts = tmp;
            }
            finally
            {
                RaiseListChangedEvents = oldRaise;
                ResetBindings();
            }
        }
Пример #2
0
 /// <summary>
 /// Removes sorted list</summary>
 protected override void RemoveSortCore()
 {
     //base.RemoveSortCore();
     _sorts = null;
 }