Exemplo n.º 1
0
        public static void doSort(ListView lw, int column)
        {
            ListViewColumnSorter lwcs = (ListViewColumnSorter)lw.ListViewItemSorter;

            // Determine if clicked column is already the column that is being sorted.
            if (column == lwcs.SortColumn)
            {
                // Reverse the current sort direction for this column.
                lwcs.Order = lwcs.Order == SortOrder.Ascending ? SortOrder.Descending : SortOrder.Ascending;
            }
            else
            {
                // Set the column number that is to be sorted; default to descending (except the name and owner column).
                lwcs.LastSortColumn = lwcs.SortColumn;
                lwcs.LastOrder      = lwcs.Order;
                lwcs.SortColumn     = column;
                lwcs.Order          = column > 1 ? SortOrder.Descending : SortOrder.Ascending;
            }

            // Perform the sort with these new sort options.
            lw.Sort();
        }
Exemplo n.º 2
0
 private void listViewTimer_ColumnClick(object sender, ColumnClickEventArgs e)
 {
     ListViewColumnSorter.doSort((ListView)sender, e.Column);
 }
Exemplo n.º 3
0
 private void listViewCreatures_ColumnClick(object sender, ColumnClickEventArgs e)
 {
     ListViewColumnSorter.DoSort((ListView)sender, e.Column);
 }