Click or drag to resize

JamBaseShellListViewSort Method

Sorts the items of the list view. Uses a custom sort order if an IComparer is assigned to property ListViewItemSorter. If no custom sortorder is supplied the default sorting handles sorting by columns and is only useful in Details. In this case SortColumn must be non-negative.

Namespace:  Jam.Shell
Assembly:  ShellBrowser (in ShellBrowser.dll) Version: 7.1
public void Sort()
This example sets a custom ListViewItemSorter on a FileList that handles the sorting when the ViewState is something else than Details.
private class CustomItemComparer : System.Collections.IComparer
   private FileList m_FileList;
   public CustomItemComparer(FileList pFileList)
       m_FileList = pFileList;

   public int Compare(object x, object y)
       if (m_FileList.ViewState == ViewState.Details)
           return m_FileList.Compare(x, y);
           FileListItem item1 = (FileListItem) x;
           FileListItem item2 = (FileListItem) y;
           if (item1 == null || item2 == null) return 0;
           return String.Compare(item1.FullPath, item2.FullPath, StringComparison.OrdinalIgnoreCase);

void TestForm_Load(object sender, EventArgs e)
    CustomItemComparer comparer = new CustomItemComparer(fileList1);
    fileList1.ListViewItemSorter = comparer; //assigning already sorts           
See Also