private void lvPathfind_ColumnClick(object sender, ColumnClickEventArgs e)
{
// Determine whether the column is the same as the last column clicked.
if (e.Column != mSortColumn)
{
// Set the sort column to the new column.
mSortColumn = e.Column;
// Set the sort order to ascending by default.
lvPathfind.Sorting = SortOrder.Ascending;
}
else
{
// Determine what the last sort order was and change it.
if (lvPathfind.Sorting == SortOrder.Ascending)
lvPathfind.Sorting = SortOrder.Descending;
else
lvPathfind.Sorting = SortOrder.Ascending;
}
// Set the ListViewItemSorter property to a new ListViewItemComparer
// object.
lvPathfind.ListViewItemSorter = new RoomsViewItemComparer(e.Column,
lvPathfind.Sorting);
// Call the sort method to manually sort.
lvPathfind.Sort();
}