BindingList<T>.ApplySortCore(PropertyDescriptor, ListSortDirection) 方法
定义
如果已在派生类中重写,则对项进行排序;否则将引发 NotSupportedException。Sorts the items if overridden in a derived class; otherwise, throws a NotSupportedException.
protected:
virtual void ApplySortCore(System::ComponentModel::PropertyDescriptor ^ prop, System::ComponentModel::ListSortDirection direction);
protected virtual void ApplySortCore (System.ComponentModel.PropertyDescriptor prop, System.ComponentModel.ListSortDirection direction);
abstract member ApplySortCore : System.ComponentModel.PropertyDescriptor * System.ComponentModel.ListSortDirection -> unit
override this.ApplySortCore : System.ComponentModel.PropertyDescriptor * System.ComponentModel.ListSortDirection -> unit
Protected Overridable Sub ApplySortCore (prop As PropertyDescriptor, direction As ListSortDirection)
参数
- prop
- PropertyDescriptor
指定要用于排序的属性的 PropertyDescriptor。A PropertyDescriptor that specifies the property to sort on.
- direction
- ListSortDirection
ListSortDirection 值之一。One of the ListSortDirection values.
例外
方法未在派生类中重写。Method is not overridden in a derived class.
注解
BindingList<T>类不提供排序的基实现,因此 ApplySortCore NotSupportedException 默认情况下始终引发。The BindingList<T> class does not provide a base implementation of sorting, so ApplySortCore always throws a NotSupportedException by default. 若要启用排序,请从派生 BindingList<T> 并执行以下任务:To enable sorting, derive from BindingList<T> and perform the following tasks:
重写 ApplySortCore 和实现排序,并 ListChanged 在排序完成后引发事件。Override ApplySortCore and implement sorting, raising the ListChanged event when sorting is complete.
重写 RemoveSortCore 并实现排序删除。Override RemoveSortCore and implement sort removal.
重写 SupportsSortingCore 并将设置 SupportsSortingCore 为
true。Override SupportsSortingCore and set SupportsSortingCore totrue.
此外,您可能还需要实现补充 SortDirectionCore 和 SortPropertyCore 排序属性。In addition, you may want to implement the supplemental SortDirectionCore and SortPropertyCore sorting properties.