Gets or sets the sorting comparer for the control.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
You can use this property to provide custom sorting, for example, when a column header is clicked in the details view. To do this, create a class that implements the IComparer interface and provides a constructor that accepts the index of a column to sort by. You can then implement a handler for the ColumnClick event that creates an instance of this class using the index of the clicked column. When you set the property to the new instance, the ListView control is automatically sorted using the specified object. Subsequent calls to the Sort method use the same object.
When you set the value of the Sort method is called automatically.property, the
The following code example creates a form that contains a ListView control that manually sorts items when a column in the ListView control is clicked. The example defines a class called ListViewItemComparer that implements the System.Collections.IComparer interface that performs the ListViewItem comparison. The example creates an instance of ListViewItemComparer and uses it to set the property of the ListView control. The Sort method call in the ColumnClick event handler uses the methods defined in ListViewItemComparer to perform the sort of items, based on the column that is clicked.
Available since 1.1