BindingList.ApplySortCore Method

Sorts the items if overridden in a derived class; otherwise, throws a NotSupportedException.

Namespace: System.ComponentModel
Assembly: System (in system.dll)

protected virtual void ApplySortCore (
	PropertyDescriptor prop,
	ListSortDirection direction
protected void ApplySortCore (
	PropertyDescriptor prop, 
	ListSortDirection direction
protected function ApplySortCore (
	prop : PropertyDescriptor, 
	direction : ListSortDirection
Not applicable.



A PropertyDescriptor that specifies the property to sort on.


One of the ListSortDirection values.

Exception typeCondition


Method is not overridden in a derived class.

The BindingList class does not provide a base implementation of sorting, so ApplySortCore always throws a NotSupportedException by default. To enable sorting, derive from BindingList and perform the following tasks:

  • Override ApplySortCore and implement sorting, raising the ListChanged event when sorting is complete.

  • Override RemoveSortCore and implement sort removal.

  • Override SupportsSortingCore and set SupportsSortingCore to true.

In addition, you may want to implement the supplemental SortDirectionCore and SortPropertyCore sorting properties.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

.NET Compact Framework

Supported in: 2.0

XNA Framework

Supported in: 1.0