ListViewItemSorter

From auWiki
Jump to navigation Jump to search

C# class for sorting a details-view ListView control by a column, treating it as a specific type.

Namespace

au.util.comctl

Hierarchy
  • System.Object
    • au.util.comctl.ListViewItemSorter
Implements
  • System.Collections.IComparer

Usage

ListViewItemSorter is used indirectly via the ListView.DetailSort() extension method defined in ListViewUtil. For normal use it is unnecessary to look inside ListViewItemSorter.

Public Properties

SortColumn

int SortColumn

Gets the index of the column used to sort the list.

IndicatorColumn

int IndicatorColumn

Gets the index of the column that will show a sort indicator.

ReverseOrder

bool ReverseOrder

Whether the sort order should be reversed.

Public Methods

new ListViewItemSorter

ListViewItemSorter()

ListViewItemSorter(int sortColumn, SortType sort, bool reverseOrder, int indicatorColumn)

ListViewItemSorter(int sortColumn, SortType sort, bool reverseOrder)

ListViewItemSorter(int sortColumn, SortType sort, int indicatorColumn)

ListViewItemSorter(int sortColumn, SortType sort)

ListViewItemSorter(int sortColumn, bool reverseOrder, int indicatorColumn)

ListViewItemSorter(int sortColumn, bool reverseOrder)

ListViewItemSorter(int sortColumn, int indicatorColumn)

ListViewItemSorter(int sortColumn)

Creates a new ListViewItemSorter to sort ListView items. The default constructor does not define a default sort while all other constructors do.

  • sortColumn = Index of the column to sort.
  • sort = How to sort the data. See SortType for options. If not specified, SortType.String is used.
  • reverseOrder = True if the column should be sorted in reverse order. If not specified, false is used.
  • indicatorColumn = Index of the column to show sort indicators on. If not specified, sortColumn is used.

SortBy

void SortBy(int columnIndex, SortType sort, bool reverseOrder, int indicatorColumnIndex)

void SortBy(int columnIndex, SortType sort, bool reverseOrder)

void SortBy(int columnIndex, SortType sort, int indicatorColumnIndex)

void SortBy(int columnIndex, SortType sort)

void SortBy(int columnIndex, bool reverseOrder, int indicatorColumnIndex)

void SortBy(int columnIndex, bool reverseOrder)

void SortBy(int columnIndex, int indicatorColumnIndex)

void SortBy(int columnIndex)

Add the specified criteria as the primary sort criteria.

  • columnIndex = Index of the column to sort.
  • sort = How to sort the data. See SortType for options. If not specified, SortType.String is used.
  • reverseOrder = True if the column should be sorted in reverse order. If not specified, false is used.
  • indicatorColumnIndex = Index of the column to show sort indicators on. If not specified, columnIndex is used.

Compare

int Compare(object x, object y)

int Compare(ListViewItem x, ListViewItem y)

Compares two ListViewItems for sorting.

  • x = First ListViewItem to compare.
  • y = Second ListViewItem to compare.
  • @return = 0 if equal, negative if x comes before y, or positive if x comes after y.