/// <inheritdoc /> /// <summary> /// 对项排序 /// </summary> /// <param name="property"></param> /// <param name="direction"></param> protected override void ApplySortCore(PropertyDescriptor property, ListSortDirection direction) { if (Items is List <T> items) { var pc = new ObjectPropertyCompare <T>(property, direction); items.Sort(pc); _isSortedCore = true; _sortDirectionCore = direction; _sortPropertyCore = property; } else { _isSortedCore = false; } OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1)); }
protected override void ApplySortCore(PropertyDescriptor property, ListSortDirection direction) { List <T> items = this.Items as List <T>; if (items != null) { ObjectPropertyCompare <T> pc = new ObjectPropertyCompare <T>(property, direction); items.Sort(pc); isSorted = true; } else { isSorted = false; } sortProperty = property; sortDirection = direction; this.OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1)); }