protected override void ApplySortCore(PropertyDescriptor property, ListSortDirection direction) { m_SortDirection = direction; m_SortProperty = property; SortComparer <T> comparer = new SortComparer <T>(property, direction); ApplySortInternal(comparer); }
//--------------------------------------------------------------------------- // ApplySortInternal //--------------------------------------------------------------------------- private void ApplySortInternal(SortComparer <T> comparer) { // store the original order of the collection if (m_OriginalCollection.Count == 0) { m_OriginalCollection.AddRange(this); } List <T> listRef = this.Items as List <T>; if (listRef == null) { return; } // Let List<T> do the actual sorting based on your comparer listRef.Sort(comparer); m_Sorted = true; OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1)); }