The ListViewItemSorter property allows you to specify the object that performs the sorting of items in the ListView. You can use the ListViewItemSorter property in combination with the Sort method to perform custom sorting. For example, you could create a class (that implements the IComparer interface) to support column sorting in the ListView control. If an instance of the class is assigned to the ListViewItemSorter property and the Sort method is called, you can then create code in the event handler for the ColumnClick event to perform sorting based on the column that was clicked.
Note
Setting the value of the ListViewItemSorter property causes the Sort method to be called automatically.
namespace movie
{
/// <summary>
/// Summary description for ColumnSorter.
/// </summary>
public class ColumnSorter : IComparer
{
public int CurrentColumn = 0;
public int Compare(object x, object y)
{
ListViewItem columnA = (ListViewItem)x;
ListViewItem columnB = (ListViewItem)y;